2013-03-01 2 views
0

특정 웹 페이지에 액세스하려고 할 때 계속해서 다음 오류가 발생합니다.System.Data.SqlClient.SqlException

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

내가 IIS에 가서 어떻게해야 오류 상태로, 응용 프로그램으로 디렉토리를 구성, 페이지가, 1 ~ 2 분 동안 응답을 기다리고하는 것, 그리고 빈 페이지를 보여줍니다 다음 오류가 발생합니다.

Server Error in '/inventory' Application. 

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 
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: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 


[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)] 
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6256377 
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245 
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +6270399 
    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +181 
    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +6271242 
    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6271208 
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +354 
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +703 
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +54 
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6272472 
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +81 
    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +1657 
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +88 
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6275911 
    System.Data.SqlClient.SqlConnection.Open() +258 
    Inventory1.welcome.Page_Load(Object sender, EventArgs e) +219 
    System.Web.UI.Control.OnLoad(EventArgs e) +132 
    System.Web.UI.Control.LoadRecursive() +66 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428 

SQL Server가 가동 중이며 사이트의 다른 모든 페이지에서 액세스 할 수 있습니다. 나는이 오류를 하루에도 몇 시간 동안 해결하려고 노력했지만 성공하지 못했습니다. 저는 IIS에 익숙하지 않으며, 지금은 시도 할 다른 것들을 생각할 수 없습니다. 누군가이 오류의 원인을 파악하도록 도울 수 있는지 궁금합니다. 이 특정 페이지는 약 2 주 전에로드되어 제대로 작동했습니다.

답변

2

그 페이지에서 수행중인 작업이 SQL Server에 액세스 할 수없는 것처럼 보입니다. 데이터베이스에 어떻게 연결합니까? Windows 인증 사용 또는 SQL Server 로그인 사용? IIS에서 가장을 사용합니까? 예를 들어, 일부 SP를 실행하려고하는데이 사용자에게는 SP를 실행할 수있는 권한이 없습니다.

IIS에서 데이터베이스 연결 관리자를 사용하여 데이터베이스 연결 액세스 가능성 (및 가용성)을 확인할 수 있습니까? This IIS help shows하는 방법.

+0

답장을 보내 주셔서 감사합니다. Windows 인증 사용. 이것은 webconfig 파일에서 사용하고있는 연결 문자열입니다.'' – AnchovyLegend

+0

데이터베이스 관리자에서 무엇을 볼 수 있습니까? – JackLock

+0

http://tinypic.com/view.php?pic=a3d0so&s=6 – AnchovyLegend

1

가상 디렉터리를 응용 프로그램으로 남겨 두어야합니다.

SQL 오류는 연결 문자열에 문제가있을 수 있습니다.

다른 페이지가 작동한다고 말하면 ... 모든 페이지가 SQL에 연결되는 표준 방법이 있습니까? 그들은 모두 web.config에서 연결 문자열을 취합니까? 또는 페이지에 하드 코딩되어 있습니까?

+0

답장을 보내 주셔서 감사합니다. 그들은 web.config 파일에서 연결 문자열을 가져옵니다. 이것은 연결 문자열입니다. AnchovyLegend

+0

이것이 세션 상태에 대한 연결 문자열입니다. 다른 연결 문자열이 필요합니다. .NET 버전에 따라 또는 섹션에 있습니다. web.config 파일에서 "; database"를 검색해보십시오. – basher

+0

'; database'를 (를) 검색해도 web.config 파일에 결과가 없습니다. – AnchovyLegend

관련 문제