无法在IIS上发布Asp.Net Core应用程序

时间:2018-06-25 07:35:50

标签: c# iis asp.net-core entity-framework-core

我正在尝试在IIS上发布我的应用程序。单击测试设置时,会出现以下错误。

  

执行此操作时出错。详细信息:无效   应用程序路径。

步骤:

  1. 打开IIS。
  2. 右键单击默认网站,然后选择添加应用程序
  3. 提供 Alias ,然后选择 DefaultAppPool 作为应用程序池,然后选择物理路径 MyProject \ bin \ Release \ PublishOutput
  4. 单击测试设置

但是,如果我尝试执行以下步骤,则可以成功发布我的应用。

  1. 打开IIS。
  2. 右键单击站点,然后选择添加网站
  3. 提供 Alias ,然后选择 DefaultAppPool 作为应用程序池,然后选择物理路径 MyProject \ bin \ Release \ PublishOutput
  4. 单击测试设置

如果我做错了任何事情,请让我知道。

IIS 6,Asp.Net Core 2.0.1,Visual Studio 2017版本15.6.6

更新

我试图在应用程序中启用日志。当我尝试浏览应用程序时,将生成日志文件。它说应用程序启动异常:MySql.Data.MySqlClient.MySqlException(0x80004005):未知数据库'spardb'。但是spardb数据库存在。那么可能是什么根本原因?

日志

  

警告:   Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository [50]         使用内存中的存储库。密钥将不会持久存储。警告:   Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager [59]         用户个人资料和HKLM注册表均不可用。使用临时密钥存储库。受保护的数据在以下情况下将不可用   应用程序退出。信息:   Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager [58]         创建密钥{98bbcd98-dbcb-4f7e-855d-d2b91729cfb1},创建日期为2018-06-27 12:42:47Z,激活日期为2018-06-27   12:42:47Z,到期日期为2018-09-25 12:42:47Z。警告:   Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager [35]         未配置XML加密器。密钥{98bbcd98-dbcb-4f7e-855d-d2b91729cfb1}可以持久存储在   未加密的形式。应用程序启动异常:   MySql.Data.MySqlClient.MySqlException(0x80004005):未知数据库   “ spardb”位于   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务   任务)   System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable 1.ConfiguredValueTaskAwaiter.GetResult() at MySqlConnector.Core.ServerSession.<SwitchAuthenticationAsync>d__58.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 342 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.Core.ServerSession.<ConnectAsync>d__56.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 256 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.Core.ConnectionPool.<GetSessionAsync>d__0.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 92 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySql.Data.MySqlClient.MySqlConnection.<CreateSessionAsync>d__77.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 355 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySql.Data.MySqlClient.MySqlConnection.<OpenAsync>d__19.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 160 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySql.Data.MySqlClient.MySqlConnection.Open() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 137 at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction(IsolationLevel isolationLevel) at Microsoft.EntityFrameworkCore.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func 3操作,功能3 verifySucceeded) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.BeginTransaction(DatabaseFacade databaseFacade, IsolationLevel isolationLevel) at Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext[TDbContext](String connectionString, IDbContextResolver dbContextResolver) at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable 1   multiTenancySide)   Nec.Spar.EntityFrameworkCore.Seed.SeedHelper.WithDbContext [TDbContext](IIocResolver   iocResolver,操作1 contextAction) in C:\Spar\FoodKioskSolution\Nec.Spar\src\Nec.Spar.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 43 at System.Collections.Generic.List 1.ForEach(操作1 action)
at Abp.AbpBootstrapper.Initialize() at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action
1 optionsAction)位于   Nec.Spar.Web.Host.Startup.Startup.Configure(IApplicationBuilder应用程序,   IHostingEnvironment env,ILoggerFactory loggerFactory)中   C:\ Spar \ FoodKioskSolution \ Nec.Spar \ src \ Nec.Spar.Web.Host \ Startup \ Startup.cs:line   102   ---从上一个引发异常的位置开始的堆栈跟踪-   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在   Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder   应用)   Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()爆击:   Microsoft.AspNetCore.Hosting.Internal.WebHost [6]         应用程序启动异常MySql.Data.MySqlClient.MySqlException(0x80004005):未知数据库   “ spardb”位于   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务   任务)   System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable 1.ConfiguredValueTaskAwaiter.GetResult() at MySqlConnector.Core.ServerSession.<SwitchAuthenticationAsync>d__58.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 342 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.Core.ServerSession.<ConnectAsync>d__56.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ServerSession.cs:line 256 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySqlConnector.Core.ConnectionPool.<GetSessionAsync>d__0.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\Core\ConnectionPool.cs:line 92 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySql.Data.MySqlClient.MySqlConnection.<CreateSessionAsync>d__77.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 355 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySql.Data.MySqlClient.MySqlConnection.<OpenAsync>d__19.MoveNext() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 160 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MySql.Data.MySqlClient.MySqlConnection.Open() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnection.cs:line 137 at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.BeginTransaction(IsolationLevel isolationLevel) at Microsoft.EntityFrameworkCore.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func 3操作,功能3 verifySucceeded) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.BeginTransaction(DatabaseFacade databaseFacade, IsolationLevel isolationLevel) at Abp.EntityFrameworkCore.Uow.DbContextEfCoreTransactionStrategy.CreateDbContext[TDbContext](String connectionString, IDbContextResolver dbContextResolver) at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable 1   multiTenancySide)   Nec.Spar.EntityFrameworkCore.Seed.SeedHelper.WithDbContext [TDbContext](IIocResolver   iocResolver,操作1 contextAction) in C:\Spar\FoodKioskSolution\Nec.Spar\src\Nec.Spar.EntityFrameworkCore\EntityFrameworkCore\Seed\SeedHelper.cs:line 43 at System.Collections.Generic.List 1.ForEach(操作1 action)
at Abp.AbpBootstrapper.Initialize() at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action
1 optionsAction)位于   Nec.Spar.Web.Host.Startup.Startup.Configure(IApplicationBuilder应用程序,   IHostingEnvironment env,ILoggerFactory loggerFactory)中   C:\ Spar \ FoodKioskSolution \ Nec.Spar \ src \ Nec.Spar.Web.Host \ Startup \ Startup.cs:line   102   ---从上一个引发异常的位置开始的堆栈跟踪-   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在   Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder   应用)   Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()   托管环境:生产内容的根路径:   C:\ Published \ PublishOutput现在正在监听:http://localhost:4725   应用程序已启动。按Ctrl + C关闭。信息:   Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求完成168.6654ms 500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求以0.363ms完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求以0.2192ms完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求在0.3408ms内完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求完成0.2087ms 500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求以0.3917ms完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求在0.3248ms内完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求以0.3079ms完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 GET http://localhost/swaggar信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求以0.2387ms完成500 text / html; charset = utf-8信息:Microsoft.AspNetCore.Hosting.Internal.WebHost [1]         请求启动HTTP / 1.1 POST http://127.0.0.1:4725/SWAGGAR/iisintegration 0信息:   Microsoft.AspNetCore.Hosting.Internal.WebHost [2]         请求在0.4856ms内完成500 text / html; charset = utf-8应用程序正在关闭...

0 个答案:

没有答案