简体   繁体   English

在Windows Server 2014中部署MVC 5的问题

[英]Issue Deploying MVC 5 to Windows Server 2014

Keep getting the same error when trying to deploy MVC5 application to new dedicated server. 尝试将MVC5应用程序部署到新的专用服务器时,始终出现相同的错误。

I have tried reinstalling the Microsoft.Web.Infrastructure package. 我尝试重新安装Microsoft.Web.Infrastructure程序包。
I have also changed the properties > Copy Local to True. 我还更改了属性>将本地复制为True。

I have checked that the Microsoft.AI.Web exists in the published bin folder. 我检查了Microsoft.AI.Web在发布的bin文件夹中是否存在。

Still getting the same error message: 仍然收到相同的错误消息:

Anyone got any ideas? 任何人有任何想法吗? Is there a server configuration necessary for MVC? MVC是否需要服务器配置?

Server Error in '/' Application. “ /”应用程序中的服务器错误。 ________________________________________ Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. ________________________________________无法加载文件或程序集“ Microsoft.AI.Web”或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 Description: An unhandled exception occurred during the execution of the current web request. 说明:执行当前Web请求期间发生未处理的异常。 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 'Microsoft.AI.Web' or one of its dependencies. 异常详细信息:System.IO.FileNotFoundException:无法加载文件或程序集“ Microsoft.AI.Web”或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。

Source Error: An unhandled exception was generated during the execution of the current web request. 源错误:当前Web请求的执行期间生成了未处理的异常。 Information regarding the origin and location of the exception can be identified using the exception stack trace below. 可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.AI.Web' could not be loaded. 程序集加载跟踪:以下信息有助于确定为什么无法加载程序集“ Microsoft.AI.Web”。

WRN: Assembly binding logging is turned OFF. WRN:程序集绑定日志记录已关闭。 To enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. 要启用程序集绑定失败日志记录,请将注册表值[HKLM \\ Software \\ Microsoft \\ Fusion!EnableLog](DWORD)设置为1。注意:程序集绑定失败日志记录会降低性能。 To turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog]. 要关闭此功能,请删除注册表值[HKLM \\ Software \\ Microsoft \\ Fusion!EnableLog]。

Stack Trace: 堆栈跟踪:

[FileNotFoundException: Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. [FileNotFoundException:无法加载文件或程序集'Microsoft.AI.Web'或其依赖项之一。 The system cannot find the file specified.] System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0 System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName) +95 System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +53 系统找不到指定的文件。] System.RuntimeTypeHandle.GetTypeByName(字符串名称,布尔型throwOnError,布尔值ignoreCase,布尔型反射,仅StackCrawlMarkHandle stackMark,IntPtr pPrivHostBinder,布尔值loadTypeFromPartialName,ObjectHandleOnStack类型)+0 System.RuntimeTypeHandle.Name,String布尔值throwOnError,布尔值ignoreCase,布尔值OnlyOnly,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,布尔值loadTypeFromPartialName)+95 System.RuntimeType.GetType(字符串类型名称,布尔型throwOnError,布尔值ignoreCase,布尔值OnlyOnly,StackCrawlMark和stackMark)+53
System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +44 System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +61 System.Type.GetType(字符串typeName,布尔throwOnError,布尔ignoreCase)+44 System.Web.Compilation.BuildManager.GetType(字符串typeName,布尔throwOnError,布尔ignoreCase)+61
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +49 System.Web.Configuration.ConfigUtil.GetType(字符串类型名称,字符串属性名称,ConfigurationElement configElement,XmlNode节点,布尔值checkAptcaBit,布尔值ignoreCase)+49

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. [ConfigurationErrorsException:无法加载文件或程序集'Microsoft.AI.Web'或其依赖项之一。 The system cannot find the file specified.] 该系统找不到指定的文件。]
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +558 System.Web.Configuration.ConfigUtil.GetType(字符串类型名称,字符串属性名称,ConfigurationElement configElement,XmlNode节点,布尔值checkAptcaBit,布尔值ignoreCase)+558
System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit) +30 System.Web.Configuration.ConfigUtil.GetType(字符串类型名称,字符串属性名称,ConfigurationElement configElement,布尔值checkAptcaBit)+30
System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +57 System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +54 System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +191 System.Web.Configuration.Common.ModulesEntry.SecureGetType(字符串类型名称,字符串propertyName,ConfigurationElement configElement)+57 System.Web.Configuration.Common.ModulesEntry..ctor(字符串名称,字符串typeName,字符串propertyName,ConfigurationElement configElement)+54 System.Web.HttpApplication.BuildIntegratedModuleCollection(列表`1 moduleList)+191
System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1086 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +123 System.Web.HttpApplication.GetModuleCollection(IntPtr appContext)+1086 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext,HttpContext上下文,MethodInfo []处理程序)+123
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +169 System.Web.HttpApplication.InitSpecial(HttpApplicationState状态,MethodInfo []处理程序,IntPtr appContext,HttpContext上下文)+169
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +396 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,HttpContext上下文)+396
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +333 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)+333

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. [HttpException(0x80004005):无法加载文件或程序集'Microsoft.AI.Web'或其依赖项之一。 The system cannot find the file specified.] 该系统找不到指定的文件。]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525 System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+525
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +124 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +700 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+124 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+700

UPDATE: 更新:

I can deploy a basic blank MVC application fine. 我可以部署基本的空白MVC应用程序。 So I thought, I would just transfer across the views, models and controllers from the project I want to deploy. 所以我想,我只想在要部署的项目中跨视图,模型和控制器进行转换。 When I do this, I get the error again. 当我这样做时,我再次收到错误。 Is there anything in code that could cause such an error? 代码中是否有任何可能导致此类错误的信息?

Hey just to update everyone, uninstalling application insights worked for the error I posted, the 404 was a routing issue. 嘿,只是为了更新每个人,卸载应用程序见解可解决我发布的错误,404是路由问题。 When running locally routing is no issue, but on the server the routing is a little different (maybe the configuration is different). 在本地运行时,路由没问题,但是在服务器上,路由略有不同(也许配置不同)。 We chose to use Url.Action (in the views) and ~/Home/Index (in our cookie checker) to achieve successful URL routing. 我们选择使用Url.Action (在视图中)和~/Home/Index (在我们的Cookie检查器中)来实现成功的URL路由。

This wasn't obvious to begin with so hope this helps someone else! 一开始这并不明显,所以希望这对其他人有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM