2012-08-13 4 views
0

Windows Server 2008 r2에서 실행되는 SQL Server 데이터베이스에서 Json 개체로 반환되는 일부 행을 가져 오려고하지만 500 내부 서버 오류가 발생했습니다. 아무도 도움을 요청할 수 없습니다. 이 문제가 해결 되었습니까? 아래에 몇 가지 추가 정보가 있습니다.http GETrequest를 통해 SQL Server 데이터베이스에 액세스 할 수 없습니다.

개발 환경 : WebMartrix 2

코드 :

경고 : 여기

@{ 
    var result = MyDataBase.GetData(); 
    Response.ContentType = "application/json"; 
    Json.Write(result, Response.Output); 

} 

는 응답 오류 메시지입니다이 페이지에 Google지도 API를 여러 번 포함했다. 예기치 않은 오류가 발생할 수 있습니다.
{메인 장소}의 .js (라인 42)는 GET
http://nopowervi.com/Pages/GetReports/
500 내부 서버 오류
577ms
JQuery와-1.7.2.js (라인 4)
HeadersResponseHTML

<html> 
<head> 
<title>Login failed for user 'IIS APPPOOL\nopowervi.com'.</title> 
<style> 
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} 
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} 
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } 
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } 
pre {font-family:"Lucida Console";font-size: .9em} 
.marker {font-weight: bold; color: black;text-decoration: none;} 
.version {color: gray;} 
.error {margin-bottom: 10px;} 
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } 
</style> 
</head> 
<body bgcolor="white"> 
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> 
<h2> <i>Login failed for user 'IIS APPPOOL\nopowervi.com'.</i> </h2></span> 
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> 
<b> Description: </b>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. 
<br><br> 
<b> Exception Details: </b>System.Data.SqlClient.SqlException: Login failed for user 'IIS APPPOOL\nopowervi.com'.<br><br> 
<b>Source Error:</b> <br><br> 
<table width=100% bgcolor="#ffffcc"> 
<tr> 
<td> 
<code><pre> 
Line 1: @{ 
<font color=red>Line 2: var result = MyDataBase.GetData(); 
</font>Line 3: Response.ContentType = &quot;application/json&quot;; 
Line 4: //Json.Write(result.OrderByDescending(d =&gt; d.Time), Response.Output);</pre></code> 
</td> 
</tr> 
</table> 
<br> 
<b> Source File: </b> c:\inetpub\nopowervi.com\Pages\GetReports.cshtml<b> &nbsp;&nbsp; Line: </b> 2 
<br><br> 
<b>Stack Trace:</b> <br><br> 
<table width=100% bgcolor="#ffffcc"> 
<tr> 
<td> 
<code><pre> 
[SqlException (0x80131904): Login failed for user &#39;IIS APPPOOL\nopowervi.com&#39;.] 
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6317296 
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412 
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2660 
System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53 
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +6337726 
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6337705 
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +352 
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +831 
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49 
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6339510 
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +78 
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +2194 
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +89 
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6343022 
System.Data.SqlClient.SqlConnection.Open() +300 
WebMatrix.Data.Database.EnsureConnectionOpen() +115 
WebMatrix.Data.&lt;QueryInternal&gt;d__0.MoveNext() +79 
System.Collections.Generic.List'1..ctor(IEnumerable'1 collection) +472 
System.Linq.Enumerable.ToList(IEnumerable'1 source) +80 
WebMatrix.Data.Database.Query(String commandText, Object[] parameters) +140 
ASP._Page_Pages_GetReports_cshtml.Execute() in c:\inetpub\nopowervi.com\Pages\GetReports.cshtml:2 
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280 
System.Web.WebPages.WebPage.ExecutePageHierarchy() +372 
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +181 
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +232 
</pre></code> 
</td> 
</tr> 
</table> 
<br> 
<hr width=100% size=1 color=silver> 
<b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET a 
</font> 
</body> 
</html> 
<!-- 
[SqlException]: Login failed for user &#39;IIS APPPOOL\nopowervi.com&#39;. 
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() 
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) 
at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) 
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) 
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) 
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) 
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) 
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) 
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) 
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) 
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) 
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) 
at System.Data.SqlClient.SqlConnection.Open() 
at WebMatrix.Data.Database.EnsureConnectionOpen() 
at WebMatrix.Data.Database.<QueryInternal>d__0.MoveNext() 
at System.Collections.Generic.List'1..ctor(IEnumerable'1 collection) 
at System.Linq.Enumerable.ToList[TSource](IEnumerable'1 source) 
at WebMatrix.Data.Database.Query(String commandText, Object[] parameters) 
at ASP._Page_Pages_GetReports_cshtml.Execute() in c:\inetpub\nopowervi.com\Pages\GetReports.cshtml:line 2 
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() 
at System.Web.WebPages.WebPage.ExecutePageHierarchy() 
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) 
at System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) 
[HttpUnhandledException]: Exception of type &#39;System.Web.HttpUnhandledException&#39; was thrown. 
at System.Web.WebPages.WebPageHttpHandler.HandleError(Exception e) 
at System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
--> 

답변

0

IIS에서 사용중인 사용자 계정에 데이터베이스에서 읽거나 데이터베이스에 쓸 수있는 권한이 없습니다.

IIS 응용 프로그램 풀 설정에서 사용중인 사용자 계정을 변경하거나 IIS AppPool/nopowervi.com 사용자 계정이 데이터베이스에서 읽을 수있는 권한을 가지도록 구성하십시오.

이 링크는 도움이 될 수 있습니다 : http://technet.microsoft.com/en-us/library/cc771170(v=ws.10).aspx

관련 문제