简体   繁体   English

无法使用IIS服务器部署ASP.NET应用程序

[英]Can't Deployed ASP.NET application using IIS server

I deployed my ASP.NET application to the IIS. 我将ASP.NET应用程序部署到IIS。 Initially it worked fine. 最初它运行良好。 But suddenly it it giving an error. 但是突然它给了一个错误。 I haven't change anything. 我什么都没改变。 But when i deployed that application using visual studio's built in server it worked fine. 但是,当我使用Visual Studio的内置服务器部署该应用程序时,它运行良好。 The error says IIS can't Find my database. 该错误表明IIS找不到我的数据库。 How Could This happen? 这怎么可能发生? This is the error message and stack trace 这是错误消息和堆栈跟踪

Cannot open database "VistasDb" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.

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: Cannot open database "VistasDb" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.


[SqlException (0x80131904): Cannot open database "VistasDb" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DefaultAppPool'.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6564850
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +84
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +368
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6592502
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6592983
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +878
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1162
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +6596173
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +103
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2102
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +116
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1079
   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6600667
   System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +233
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +278
   System.Data.SqlClient.SqlConnection.Open() +239
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +292
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +277
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +3318587
   System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +176
   System.Web.UI.WebControls.ListControl.PerformSelect() +51
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +146
   System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +36
   System.Web.UI.Control.PreRenderRecursiveInternal() +113
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Control.PreRenderRecursiveInternal() +222
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297

use Windows Authentication to login sql server; 使用Windows Authentication登录sql服务器; then : 然后 :

Security -> Logins ->(right click) create a new login name ; Security -> Logins ->(右键单击) create a new login name

choice SQL Server Authentication and write the login name and password ; 选择SQL Server Authentication并输入login namepassword

then modify your web.config like this: 然后像这样修改您的web.config:

<appSettings>
  <add key="dbconnectstring" value="server=your db server    address;database=dbname;uid=login name;pwd=password;"/>
</appSettings>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在部署到IIS服务器的ASP.NET应用程序中使用Powershell - Using Powershell in an ASP.NET application deployed to an IIS server 无法使用本地IIS服务器运行asp.net应用程序 - Can not run asp.net application using Local IIS Server 通过IIS服务器部署和运行应用程序时,Asp.net按钮和复选框不可见 - Asp.net buttons and checkboxes not visible when application deployed and run through IIS server 无法调试IIS中存储的ASP.NET应用程序 - Can't debug ASP.NET application stored in IIS 用于部署在 IIS 上的应用程序的空白 ASP.NET 网页 - Blank ASP.NET Webpage for the application deployed on IIS 无法使用本地IIS服务器打开Visual Studio asp.net项目 - Can't open Visual studio asp.net project using local IIS server 在ASP.NET应用程序中,因为使用的是IIS应用程序,所以不能使用“ /”作为根目录。 有没有办法解决? - In an ASP.NET application, I can't use “/” to go to the root, because I'm using an IIS application. Is there any way around this? iis上部署的asp.net的访问被拒绝 - access denied for asp.net deployed on iis 部署ASP.Net应用程序后出现服务器错误 - Server error after ASP.Net application deployed 无法在Windows Server 2012上部署ASP.net应用程序 - can't deploy ASP.net application on windows Server 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM