ASP.NET Core - 在本地IIS上发布

时间:2016-12-02 11:29:19

标签: asp.net iis asp.net-core publish webdeploy

我尝试使用Visual Studio 2015中的Web Deploy功能将我的ASP.NET Core(使用.NET Framework)部署到我的PC本地IIS服务器。

我以前通过IIS管理控制台创建了网站,当我启动发布时,该过程会运行一段时间,但失败并出现以下错误:

Web deployment task failed. (The specified credentials cannot be used with the authentication scheme 'Basic'.)

The specified credentials cannot be used with the authentication scheme 'Basic'.
Default credentials cannot be supplied for the Basic authentication scheme.
Parameter name: authType

我该如何解决这个问题?

提前谢谢大家!

修改

我能够在Joe Audette way发布,但如果我尝试打开网站,浏览器会显示IIS默认演示文稿页面,如果我将 / wwwroot 添加到网址( http://localhost:2020/wwwroot )它开始加载但失败了:

enter image description here

在事件查看器中存在以下错误:

Nome dell'applicazione che ha generato l'errore: FrancescoBombardiSite.exe, versione: 1.0.0.0, timestamp: 0x583c58cc
Nome del modulo che ha generato l'errore: KERNELBASE.dll, versione: 10.0.14393.321, timestamp: 0x57f4c4f0
Codice eccezione: 0xe0434352
Offset errore 0x0000000000017788
ID processo che ha generato l'errore: 0x2c24
Ora di avvio dell'applicazione che ha generato l'errore: 0x01d24ca340117e4e
Percorso dell'applicazione che ha generato l'errore: C:\inetpub\wwwroot\FrancescoBombardi\FrancescoBombardiSite.exe
Percorso del modulo che ha generato l'errore: C:\WINDOWS\System32\KERNELBASE.dll

ID segnalazione:28d01740-6aa7-4b47-b655-b29b954e647e Nome completo pacchetto che ha generato l' errore: ID applicazione relativo al pacchetto che ha generato l' errore:

Failed to start process with commandline '"C:\inetpub\wwwroot\FrancescoBombardi\FrancescoBombardiSite.exe" .\FrancescoBombardiSite.exe', ErrorCode = '0x80004005'.

此外,在日志文件夹中,有多个日志说:

fail: Microsoft.EntityFrameworkCore.Query.Internal.SqlServerQueryCompilationContextFactory[1]
  An exception occurred in the database while iterating the results of a query.
  System.Data.SqlClient.SqlException (0x80131904): Cannot open database "aspnet-FrancescoBombardiSite-f583e776-b66c-44ed-9cc9-af235eed1ae0" requested by the login. The login failed.
  Login failed for user 'NT AUTHORITY\SYSTEM'.
     in System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
     in System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
     in System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
     in System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
     in System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
     in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
     in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
     in System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
     in System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
     in System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
     in System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
     in System.Data.SqlClient.SqlConnection.Open()
     in Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
     in Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
     in Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
     in Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
     in Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
  ClientConnectionId:d384f84d-2b93-4172-ace7-96b6e52aa1a5
  Error Number:4060,State:1,Class:11
System.Data.SqlClient.SqlException (0x80131904): Cannot open database "aspnet-FrancescoBombardiSite-f583e776-b66c-44ed-9cc9-af235eed1ae0" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
   in System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
   in System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   in System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   in System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   in System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   in System.Data.SqlClient.SqlConnection.Open()
   in Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
   in Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
   in Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
   in Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
   in Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
ClientConnectionId:d384f84d-2b93-4172-ace7-96b6e52aa1a5
Error Number:4060,State:1,Class:11

Eccezione non gestita: System.Data.SqlClient.SqlException: Cannot open database "aspnet-FrancescoBombardiSite-f583e776-b66c-44ed-9cc9-af235eed1ae0" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
   in System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
   in System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   in System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   in System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   in System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   in System.Data.SqlClient.SqlConnection.Open()
   in Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
   in Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
   in Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
   in Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
   in Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
   in System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   in System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   in FrancescoBombardiSite.Data.DataInitializer.CreateAdminFunctions() in C:\Code\VisualStudioProjects\BMSoftware\FrancescoBombardiSite\src\FrancescoBombardiSite\Data\DataInitializer.cs:riga 44
   in FrancescoBombardiSite.Data.DataInitializer.<InitializeDataAsync>d__4.MoveNext() in C:\Code\VisualStudioProjects\BMSoftware\FrancescoBombardiSite\src\FrancescoBombardiSite\Data\DataInitializer.cs:riga 35
--- Fine traccia dello stack da posizione precedente dove Š stata generata l'eccezione ---
   in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   in FrancescoBombardiSite.Startup.<Configure>d__5.MoveNext() in C:\Code\VisualStudioProjects\BMSoftware\FrancescoBombardiSite\src\FrancescoBombardiSite\Startup.cs:riga 323
--- Fine traccia dello stack da posizione precedente dove Š stata generata l'eccezione ---
   in System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
   in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   in System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   in System.Threading.ThreadPoolWorkQueue.Dispatch()

1 个答案:

答案 0 :(得分:0)

错误消息看起来无法连接到数据库。

我猜您需要更新已发布文件中的连接字符串。