我在構建WebApi端點,並且已在本地進行了測試,並且運行良好。我已經將它安裝在服務器上並指向另一個服務,但是當它嘗試發送請求時,我得到一個運行時錯誤。當我檢查事件查看器,我的終點是在我發現了這個錯誤:嘗試使用端點時無法加載文件或程序集System.Web.Mvc
Exception type: InvalidOperationException
Exception message: The pre-application start initialization method PreAppStart on type Microsoft.Web.Mvc.ViewEngineFix threw an exception with the following error message: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
at System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures)
at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods)
at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at Microsoft.Web.Mvc.ViewEngineFix.PreAppStart()
我試圖改變在web.config中的版本號和甚至試圖使原位缺口通過的NuGet設法留住參考目錄System.Web.Mvc.dll但沒有工作。
任何幫助,非常感謝!
它看起來像某種程度上,當我建立的解決方案把它放在服務器上的System.Web.Mvc不復制到解決方案期望它的bin。現在我正在研究這一點。 – SketchyTurtle