0

Visual Studio 2010 で既定の ASP.NET MVC 2 Web アプリケーションを作成しています。次に、このアプリケーションを IIS サーバーのディレクトリに展開しています。Visual Studio で既定のアプリを正常に実行できます。ただし、これはサーバーでアプリを実行しようとしたときに発生するエラーです。

Server Error in '/apps/myapp' Application.
--------------------------------------------------------------------------------

Runtime Error 
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration> 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration> 

追加後

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration> 

新しいエラーがあります:

Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error: 


Line 28:         <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Line 29:         <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Line 30:         <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
Line 31:       </assemblies>
Line 32:     </compilation> 

Source File: D:\Data\Intranet\Apps\icaps\web.config    Line: 30 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.


=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///D:/Data/Intranet/Apps/icaps/
LOG: Initial PrivatePath = D:\Data\Intranet\Apps\icaps\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Data\Intranet\Apps\icaps\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/apps_icaps/d8535ca2/6aefb703/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/apps_icaps/d8535ca2/6aefb703/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///D:/Data/Intranet/Apps/icaps/bin/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///D:/Data/Intranet/Apps/icaps/bin/System.Web.Mvc/System.Web.Mvc.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/apps_icaps/d8535ca2/6aefb703/System.Web.Mvc.EXE.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/apps_icaps/d8535ca2/6aefb703/System.Web.Mvc/System.Web.Mvc.EXE.
LOG: Attempting download of new URL file:///D:/Data/Intranet/Apps/icaps/bin/System.Web.Mvc.EXE.
LOG: Attempting download of new URL file:///D:/Data/Intranet/Apps/icaps/bin/System.Web.Mvc/System.Web.Mvc.EXE.

ありがとう!

4

2 に答える 2

-1

これは、エラーが発生したことを意味し、IIS が指示するように Web.config を変更して、スローされている例外を実際に確認できるようにする必要があります。

完全に明確にするためcustomErrorsに、web.config の要素を次のように変更します。

<configuration>
  <system.web>
    <customErrors mode="Off"/>
  </system.web>
</configuration> 
于 2013-09-19T17:14:13.777 に答える