Help with Gallery Install - 'SchemaInfo' in the database.

Sep 2, 2011 at 3:40 PM

I'm trying to set up an in-house gallery server, following the directions on http://docs.nuget.org/docs/contribute/setting-up-a-local-gallery

Getting this error (below) when I try to hit the service directly for the first time:  (Step 4 of Configure and build the NuGet Gallery Services)

I  tried blowing away SQLExpress and reinstalled/re-created databases.  Same result.  Any ideas?

 

Server Error in '/' Application.

There is already an object named 'SchemaInfo' in the database.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: There is already an object named 'SchemaInfo' in the database.

Source Error:

Line 19: 
Line 20:             EnsureAppDataFolderExists();
Line 21:             IoC.Resolver.Resolve<IDatabaseBootstrapper>().InitializeDatabase();
Line 22:             IoC.Resolver.Resolve<IMapperBootstrapper>().RegisterMappings();
Line 23:             RegisterWcfRoutes();


Source File: c:\NuGet\nugetgallery\Services\GalleryServer\src\Gallery.Server\Global.asax.cs    Line: 21

Sep 2, 2011 at 4:51 PM

Here is the stack trace, if that is helpful

Stack Trace:

[SqlException (0x80131904): There is already an object named 'SchemaInfo' in the database.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +404
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1363
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +2885068
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +504
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +327
   Migrator.Providers.TransformationProvider.ExecuteNonQuery(String sql) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:566
   Migrator.Providers.TransformationProvider.AddTable(String table, String engine, String columns) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:141
   Migrator.Providers.TransformationProvider.AddTable(String name, String engine, Column[] columns) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:203
   Migrator.Providers.TransformationProvider.AddTable(String name, Column[] columns) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:161
   Migrator.Providers.TransformationProvider.CreateSchemaInfoTable() in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:790
   Migrator.Providers.TransformationProvider.get_AppliedMigrations() in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:752
   Migrator.BaseMigrate..ctor(List`1 availableMigrations, ITransformationProvider provider, ILogger logger) in c:\Dev\MigratorDotNet\trunk\src\Migrator\BaseMigrate.cs:19
   Migrator.MigrateAnywhere..ctor(List`1 availableMigrations, ITransformationProvider provider, ILogger logger) in c:\Dev\MigratorDotNet\trunk\src\Migrator\MigrateAnywhere.cs:14
   Migrator.BaseMigrate.GetInstance(List`1 availableMigrations, ITransformationProvider provider, ILogger logger) in c:\Dev\MigratorDotNet\trunk\src\Migrator\BaseMigrate.cs:25
   Migrator.Migrator.MigrateTo(Int64 version) in c:\Dev\MigratorDotNet\trunk\src\Migrator\Migrator.cs:136
   Migrator.Migrator.MigrateToLastVersion() in c:\Dev\MigratorDotNet\trunk\src\Migrator\Migrator.cs:85
   Gallery.Server.Global.Application_Start(Object sender, EventArgs e) in c:\NuGet\nugetgallery\Services\GalleryServer\src\Gallery.Server\Global.asax.cs:21

[HttpException (0x80004005): There is already an object named 'SchemaInfo' in the database.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +4043621
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375

[HttpException (0x80004005): There is already an object named 'SchemaInfo' in the database.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11612256
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4842149

 

Sep 2, 2011 at 7:06 PM

We have a newer gallery in development, which is significantly easier to deploy than this one (you pretty much build and run!). You can get it from https://github.com/NuGet/NuGetGallery. It's not completely finished, but is getting close. It would be great if you could give it a try and give us feedback. Thanks!

Sep 9, 2011 at 12:56 AM
Edited Sep 15, 2011 at 1:04 AM

I had the same problem.  Originally I created a clone of the NuGet Gallery from here: https://hg01.codeplex.com/nugetgallery;

I built using the powershell script Setup-NuGetGallery.ps1 in the Scripts folder on a Windows Server 2008 Standard machine with SQL Server 2008.  I got the exact same error when I tried to browse to the feeds (http://localhost:86/FeedService.svc) for the first time. 

I updated to the tip, upgraded the SQL Server to 2008 R2 and built again using the powershell script.  Exact same error again.  Looks like an error in the Migrator.NET code or the way the migrator code is being used.  This is used for ensuring the database schema matches the version of the application.  (The project site is here http://code.google.com/p/migratordotnet/).

Below is a log from running the powershell script...

PS C:\NuGetGallery> .\Scripts\Setup-NuGetGallery.ps1

Supply values for the following parameters:

SQL Server Name [(local)\SQLExpress]:
Web Services App Pool Name [NuGetGalleryServices]:
Web Services Database Name [NuGetGallery.Services]:
Web Services IIS Site Name [NuGetGallery.Website]:
Web Services IIS Site Port [86]:
Website App Pool Name [NuGetGalleryWebsite]:
Website Database Name [NuGetGallery.Website]:
Website IIS Site Name [NuGetGallery.Website]:
Website IIS Site Port [85]:
Orchard Password [orchard]:
SMTP From Email Address [software.support@atlastech.co.nz]:
SMTP Host [v-rot-exch01.scionresearch.com]:
SMTP Port [587]:
Use SSL for SMTP? [true]:
Use Credential for SMTP? [true]:
SMTP Credential User Name [software.support@atlastech.co.nz]:
SMTP Credential Password [******]:

This script will delete your existing NuGet Gallery databases and IIS websites.
Do you want to proceed?

y/[n]: y

The World Wide Web Publishing Service service is stopping.
The World Wide Web Publishing Service service was stopped successfully.


Dropping database NuGetGallery.Services
Creating database NuGetGallery.Services
Building the web services
processed file: .\Services\GalleryServer\src\Gallery.Server\App_Data
Successfully processed 1 files; Failed processing 0 files
APPPOOL object "NuGetGalleryServices" deleted
APPPOOL object "NuGetGalleryServices" added
APPPOOL object "NuGetGalleryServices" changed
SITE object "NuGetGallery.Website" deleted
SITE object "NuGetGallery.Website" added
APP object "NuGetGallery.Website/" added
VDIR object "NuGetGallery.Website/" added
APP object "NuGetGallery.Website/" changed
Dropping login IIS APPPOOL\NuGetGalleryServices
Creating login IIS APPPOOL\NuGetGalleryServices
Creating user IIS APPPOOL\NuGetGalleryServices in NuGetGallery.Services
Setting MigratorProvider=SqlServer in .\Services\GalleryServer\src\Gallery.Server\AppSettings.config
Setting connection string GalleryFeedEntities with value Data Source=(local)\SQLExpress;Initial Catalog=NuGetGallery.Services;Integrated Security=SSPI in .\Services\GalleryServer\src\Gallery.Server\ConnectionStrings.config
Dropping database NuGetGallery.Website
Creating database NuGetGallery.Website
Building the website
processed file: .\Website\src\Orchard.Web\App_Data
Successfully processed 1 files; Failed processing 0 files
processed file: .\Website\src\Orchard.Web\Media
Successfully processed 1 files; Failed processing 0 files
APPPOOL object "NuGetGalleryWebsite" deleted
APPPOOL object "NuGetGalleryWebsite" added
APPPOOL object "NuGetGalleryWebsite" changed
SITE object "NuGetGallery.Website" deleted
SITE object "NuGetGallery.Website" added
APP object "NuGetGallery.Website/" added
VDIR object "NuGetGallery.Website/" added
APP object "NuGetGallery.Website/" changed
Dropping login IIS APPPOOL\NuGetGalleryWebsite
Creating login IIS APPPOOL\NuGetGalleryWebsite
Creating user IIS APPPOOL\NuGetGalleryWebsite in NuGetGallery.Website
Stopping the default website
ERROR ( hresult:80010006, message:Command execution failed.
The connection terminated or is in a bogus state and cannot be used any more. Other connections are still valid. )
Modifying NuGet Gallery setup recipe for Orchard
The World Wide Web Publishing Service service is starting.
The World Wide Web Publishing Service service was started successfully.

Starting website NuGetGallery.Website
"NuGetGallery.Website" successfully started.
Starting website NuGetGallery.Website
"NuGetGallery.Website" successfully started.
Running Orchard.exe setup
Initializing Orchard session. (This might take a few seconds...)
Site "NuGet Gallery" successfully setup to run data provider "SQLServer" (with table prefix "") and configured by recipe "NuGet Gallery"

PS C:\NuGetGallery>

There is an error in here...

"ERROR ( hresult:80010006, message:Command execution failed.
The connection terminated or is in a bogus state and cannot be used any more. Other connections are still valid. )"

but it doesn't seem to directly cause any grief.  The databases seem to get created ok.  The NuGetGallery.Services has no tables but as soon as I browse to the FeedService it creates the SchemaInfo table and then in the browser generates....

 

[SqlException (0x80131904): There is already an object named 'SchemaInfo' in the database.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +228
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +326
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   Migrator.Providers.TransformationProvider.ExecuteNonQuery(String sql) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:563
   Migrator.Providers.TransformationProvider.AddTable(String table, String engine, String columns) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:141
   Migrator.Providers.TransformationProvider.AddTable(String name, String engine, Column[] columns) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:203
   Migrator.Providers.TransformationProvider.AddTable(String name, Column[] columns) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:161
   Migrator.Providers.TransformationProvider.CreateSchemaInfoTable() in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:790
   Migrator.Providers.TransformationProvider.MigrationApplied(Int64 version) in c:\Dev\MigratorDotNet\trunk\src\Migrator.Providers\TransformationProvider.cs:769
   Migrator.MigrateAnywhere.ApplyMigration(IMigration migration, MigrationAttribute attr) in c:\Dev\MigratorDotNet\trunk\src\Migrator\MigrateAnywhere.cs:80
   Migrator.MigrateAnywhere.Migrate(IMigration migration) in c:\Dev\MigratorDotNet\trunk\src\Migrator\MigrateAnywhere.cs:69
   Migrator.Migrator.MigrateTo(Int64 version) in c:\Dev\MigratorDotNet\trunk\src\Migrator\Migrator.cs:168
   Migrator.Migrator.MigrateToLastVersion() in c:\Dev\MigratorDotNet\trunk\src\Migrator\Migrator.cs:85
   Gallery.Infrastructure.Impl.MigrationBootstrapper.Migrate() in c:\NuGetGallery\Services\GalleryServer\src\Gallery.Infrastructure\Impl\MigrationBootstrapper.cs:36
   Gallery.Infrastructure.Impl.MigrationBootstrapper.InitializeDatabase() in c:\NuGetGallery\Services\GalleryServer\src\Gallery.Infrastructure\Impl\MigrationBootstrapper.cs:25
   Gallery.Server.Global.Application_Start(Object sender, EventArgs e) in c:\NuGetGallery\Services\GalleryServer\src\Gallery.Server\Global.asax.cs:18

[HttpException (0x80004005): There is already an object named 'SchemaInfo' in the database.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9051697
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +131
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

[HttpException (0x80004005): There is already an object named 'SchemaInfo' in the database.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8972180
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256

Not too sure what to try now...

Sep 9, 2011 at 1:13 AM

Did you try the new gallery I mentioned above?

Sep 9, 2011 at 4:53 AM

Oh .. I tried just now and had problems with git.

Attempting to create a clone I got ...

C:\NuGetGallery>git clone git@github.com:NuGet/NuGetGallery.git
Cloning into NuGetGallery...
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of know
n hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

C:\NuGetGallery>
:-(

Coordinator
Sep 9, 2011 at 5:00 AM

Odd. You can try downloading it https://github.com/NuGet/NuGetGallery/archives/master

Phil

Sep 9, 2011 at 6:07 AM

Try 'git clone https://github.com/NuGet/NuGetGallery'

Sep 9, 2011 at 2:41 PM

Thanks David, I was about to mention you get that issue if your firewall admin has not opened the proper ports for git. The https alternative method usually works well.
____
Rob
"Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds
http://ferventcoder.com
http://twitter.com/ferventcoder

Sep 9, 2011 at 8:36 PM

Sorry, I 've been a bit busy with some other projects.  Below are my notes for installing from the new source tree.
I was unable to get the mailer working for the auto-registration (probably my shortcoming), but was able to parse through the mail sitting in App_Data/Mail to set up an account and log in.
I'm not convinced yet that I want the auto-registration to work, as I plan to use this in-house only and will be pushing artifacts from the build machine or uploading the 3rdParty artifacts in a controlled fashion. 
Having a few dozen developers pushing code up there willy-nilly seems a recipe for disaster.  :-) 

I haven't had a chance to try this again from scratch to verify the steps.  I'm going to see if I can get a proof of concept going with our Continuous Integration system first. 

This install was MUCH simpler than trying to use the instructions from the original page.  Thanks for that!

++++++

Pre-requisites

Installing NuGet Gallery

  • per https://github.com/NuGet/NuGetGallery
  • Install NuGet
  • clone the repo
    mkdir c:\NuGet
    cd c:\NuGet
    git clone https://github.com/NuGet/NuGetGallery.git
    
  • Build the project ( in powershell )
    • enable script execution
      Set-ExecutionPolicy unrestricted
    • Build the project
      cd NuGetGallery
      .\Build-Solution.ps1
      
  • Ensure that the application pool for each of these IIS websites is running .NET 4.0 in Integrated Mode
    • IIS Manager -> Application Pools -> right click on application, Basic Settings
  • Grant Permissions to database
    osql -S .\SQLEXPRESS -E
    use NuGetGallery
    exec sp_grantlogin 'IIS APPPOOL\nuget';
    exec sp_addrolemember 'db_owner', 'IIS APPPOOL\nuget'
    go
    
  • create mail directory
    cd c:\Nuget\NuGetGallery\
    mkdir Website
    mkdir Website\App_Data
    mkdir Website\App_Data\Mail
    
  • go to gallery homepage
Sep 12, 2011 at 6:20 PM

Ok, dumb question time ...

 

What is the Feed service URL supposed to be?  I keep getting a 404.

I've tried:

http://localhost/Feeds http://localhost/Feeds.svc 

Is there another step I need to do to set up the feed?

 

Thanks!

Sep 12, 2011 at 6:30 PM

Try http://localhost/api/feeds/

Sep 12, 2011 at 6:39 PM

Bingo!  Thanks, you're my new hero :-)

Sep 12, 2011 at 6:41 PM

It's a little hard to discover and I had to look at the code. It's all in Website\App_Start\Routes.cs in case you want to change it:

            routes.MapServiceRoute(
                RouteName.ApiFeeds,
                "api/feeds",
                typeof(Feeds));

Sep 12, 2011 at 10:15 PM

Sorry if I'm a bit slow but after the powershell build (Build-Solution.ps1), do I need to manually create the websites/app pools in IIS Manager?

Thanks for the help. 

Sep 12, 2011 at 11:13 PM

By default, the project uses the VS development server, so you'll need to deploy that to IIS the same way you would for any ASP.NET web app.

Sep 13, 2011 at 3:29 PM

Thanks for all your help, David.

Another question ... Are there default admin credentials?

How does one configure this? 

Sep 13, 2011 at 8:54 PM

I'm not sure that's implemented yet. There may be an issue tracking it on https://github.com/NuGet/NuGetGallery/issues.  If not, feel free to open one! :)

Sep 15, 2011 at 10:19 PM

Thanks also guys.

I finally got my server going after a bit of fiddling with mail pick up directories.  I didn't want to use one so had to configure for our SMTP server.  Then had trouble with certificates.  Seems to be working well now.

Just to confirm tho' .. there is only one website?  There used to be a separate one to handle to feeds but now it is integrated?

Thanks again.