我經歷了許多答案,但之前回答我不幸運找到我的問題的解決方案。這無法加載文件或程序集'System.Web.WebPages.Razor,版本= 3.0.0.0,文化=中立,PublicKeyToken = 31bf3856ad364e35'和我使用的許多其他人。無法加載文件或程序集'System.Web.WebPages.Razor,版本= 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'ASP.NET MVC
****以下是運行時錯誤:****
無法加載文件或程序集「System.Web.WebPages.Razor,版本= 3.0.0.0,文化=中性公鑰= 31bf3856ad364e35 '或它的一個依賴關係。定位的程序集清單定義與程序集引用不匹配。 (從HRESULT異常:0x80131040)
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.
異常詳細信息:System.IO.FileLoadException:無法加載文件或程序集「System.Web.WebPages.Razor,版本= 3.0.0.0,文化=中性公鑰= 31bf3856ad364e35'或其依賴項之一。定位的程序集清單定義與程序集引用不匹配。 (從HRESULT異常:0x80131040)
源錯誤:在當前web請求的執行過程中生成
未處理的異常。關於異常的來源和位置的信息可以使用下面的異常堆棧跟蹤來標識。
程序集加載跟蹤:以下信息可以幫助確定程序集「System.Web.WebPages.Razor,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35」爲什麼無法加載。
===預綁定狀態信息=== LOG:DisplayName的= System.Web.WebPages.Razor,版本= 3.0.0.0,文化=中性公鑰= 31bf3856ad364e35 (完全指定的) LOG:應用平臺=文件:/// C:/ menupoly /阿卜杜拉/ MEN1/MenuSnaps/ LOG:初始PrivatePath = C:\ menupoly \阿卜杜拉\ MEN1 \ MenuSnaps \ BIN
調用組件:Microsoft.Web.Helpers,版= 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35。
LOG:此綁定在默認加載上下文中啓動。 日誌:使用應用程序配置文件:C:\ menupoly \ abdulla \ men1 \ MenuSnaps \ web.config LOG:使用主機配置文件:C:\ Users \ user \ Documents \ IISExpress \ config \ aspnet.config LOG:使用機器配置文件從C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config。 日誌:後策略引用:System.Web.WebPages.Razor,版本= 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35 日誌:嘗試下載新的URL文件:/// C:/ Users/user/AppData/Local/Temp/Temporary ASP.NET Files/root/c0c49273/dff4168/System.Web.WebPages.Razor.DLL。 日誌:嘗試下載新的URL文件:/// C:/ Users/user/AppData/Local/Temp/Temporary ASP.NET Files/root/c0c49273/dff4168/System.Web.WebPages.Razor/System.Web。 WebPages.Razor.DLL。 日誌:試圖下載新的URL文件:/// C:/menupoly/abdulla/men1/MenuSnaps/bin/System.Web.WebPages.Razor.DLL。 WRN:比較彙編名稱導致不匹配:主版本 ERR:未完成彙編設置(hr = 0x80131040)。探測終止。
堆棧跟蹤:
[FileLoadException:未能加載文件或程序集「System.Web.WebPages.Razor,版本= 3.0.0。0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依賴項之一。定位的程序集清單定義與程序集引用不匹配。 (從HRESULT異常:0x80131040)] Microsoft.Web.Helpers.PreApplicationStartCode.Start()0
[InvalidOperationException異常:本申請前的啓動初始化方法開始於式Microsoft.Web.Helpers.PreApplicationStartCode拋出異常與以下錯誤消息:無法加載文件或程序集「System.Web.WebPages.Razor,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35」或其某個依賴項。定位的程序集清單定義與程序集引用不匹配。 (從HRESULT異常:0x80131040)。] System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection的1 methods, Func
1個setHostingEnvironmentCultures)613個 System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1方法)141 的System.Web。 Compilation.BuildManager.CallPreStartInitMethods(字符串preStartInitListPath,布爾& isRefAssemblyLoaded)102 System.Web.Compilation.BuildManager.ExecutePreAppStart()157 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager AppManager的,IApplicationHost APPHOST,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)+531
[HttpException(0x80004005):預應用程序啓動初始化方法啓動類型Microsoft.Web.Helpers.PreApplicationStartCode拋出一個異常,並顯示以下錯誤消息:無法加載文件或程序集'System.Web.WebPages.Razor,版本= 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依賴項之一。定位的程序集清單定義與程序集引用不匹配。 (從HRESULT異常:0x80131040)。] System.Web.HttpRuntime.FirstRequestInit(HttpContext的上下文)9946024 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext的上下文)90 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest WR,HttpContext的上下文)+261
**This is the portion of my Web.Config**
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebMatrix.WebData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebMatrix.Data" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
I verified the version of each on Reference are the same as on Web.Config. Please help me. Thank you for your help.
有時這種類型的錯誤發生在解決方案構建中時出現錯誤。先修復構建錯誤,然後重新啓動IIS。 – yyou