当前位置: 动力学知识库 > 问答 > 编程问答 >

.net - Switch to Local IIS = "Could not load file or assembly Prerender_asp_mvc"

问题描述:

When I create a new blank MVC4 project in Visual Studio 2013 Premium, after adding a controller and view, then running the project I can see my view. This project by default is hosted by IIS Express.

If I then switch the project to Local IIS, and try running it again, I get an exception:

Could not load file or assembly 'Prerender_asp_mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

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.IO.FileNotFoundException: Could not load file or assembly 'Prerender_asp_mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Assembly load trace is:

=== Pre-bind state information ===

LOG: DisplayName = Prerender_asp_mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null

(Fully-specified)

LOG: Appbase = file:///D:/Test/MvcApplication1/MvcApplication1/

LOG: Initial PrivatePath = D:\Test\MvcApplication1\MvcApplication1\bin

Calling assembly : (Unknown).

LOG: This bind starts in default load context.

LOG: Using application configuration file: D:\Test\MvcApplication1\MvcApplication1\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: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/mvcapplication1/70ab3f21/342644ce/Prerender_asp_mvc.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/mvcapplication1/70ab3f21/342644ce/Prerender_asp_mvc/Prerender_asp_mvc.DLL.

LOG: Attempting download of new URL file:///D:/Test/MvcApplication1/MvcApplication1/bin/Prerender_asp_mvc.DLL.

LOG: Attempting download of new URL file:///D:/Test/MvcApplication1/MvcApplication1/bin/Prerender_asp_mvc/Prerender_asp_mvc.DLL.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/mvcapplication1/70ab3f21/342644ce/Prerender_asp_mvc.EXE.

LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/mvcapplication1/70ab3f21/342644ce/Prerender_asp_mvc/Prerender_asp_mvc.EXE.

LOG: Attempting download of new URL file:///D:/Test/MvcApplication1/MvcApplication1/bin/Prerender_asp_mvc.EXE.

LOG: Attempting download of new URL file:///D:/Test/MvcApplication1/MvcApplication1/bin/Prerender_asp_mvc/Prerender_asp_mvc.EXE.

Version Information:

Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

What has gone wrong here? I cannot find much info on Prerender_asp_mvc.

I can post the full stack trace if needed.

网友答案:

PublicKeyToken = null tells you that the CLR is looking for the unsigned assembly. Since you signed them, that's not going to work well and this behavior is expected.

You will have to rebuild the program so it uses the updated signed assembly and embeds the non-null PublicKeyToken into the manifest. You may have to remove the existing assembly reference and add it back, it isn't clear from the question whether you built the program using an unsigned copy.

If you still can't figure out which file fails loading, try using a tool such as Fusion Log Viewer (run fuslogvw.exe from the Visual Studio command prompt), to determine which files the CLR was trying to load and from where, so that you can see exactly what failed.

SOURCE

分享给朋友:
您可能感兴趣的文章:
随机阅读: