MVC应用程序航线池回收(更新标题14年3月3日)后会丢失 [英] MVC routes lost after app pool recycle (updated title 3/3/14)

查看:131
本文介绍了MVC应用程序航线池回收(更新标题14年3月3日)后会丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想部署一个ASP.NET MVC 4 Web应用程序到生产服务器(Windows Server 2008 R2 [64]安装SP1,运行IIS 7.5)已经有几个其他工作ASP.NET应用程序。所有我能得到的是一个403指数,以及其他一切,但静态内容404。该应用程序工作没有在IIS 7.5的我的本地机器的实例的问题(我是在Windows 7上运行,最多最新的64位。)

I am trying to deploy an ASP.NET MVC 4 web application to a production server (Windows Server 2008 R2 [x64] with SP1 installed, running IIS 7.5) that already has several other working ASP.NET applications. All I can get is a 403 at index, and a 404 for everything else but the static content. The application works without a problem on my local machine's instance of IIS 7.5 (And I am running on Windows 7, up-to-date, 64-bit.)


  • <模块runAllManagedModulesForAllRequests =真/>

  • 试图申请无扩展名的URL的Microsoft修补程序(在 http://support.microsoft.com/发现KB / 980368 )(没有帮助,Service Pack 1包括它的话)

  • 确保HTTP错误,HTTP重定向和静态内容被添加到角色服务(<一个href=\"http://stackoverflow.com/a/4264564/1030925\">http://stackoverflow.com/a/4264564/1030925)

  • 运行命令为aspnet_regiis -iru

  • 应用程序确保在位数是正确的(任何CPU)

  • 绷使32位应用程序

  • 经典和集成模式之间的切换

  • 确保允许非上市的文件扩展名被选中(<一个href=\"http://stackoverflow.com/a/5155322/1030925\">http://stackoverflow.com/a/5155322/1030925)

  • 确保ExtensionlessUrlHandler映射完好

  • 确保我的启动code在的Application_Start,而不是别的东西

  • 确保文件夹权限ApplicationPoolIdentity(它可以提供静态内容)

  • 重新添加 UrlRoutingModule-4.0 模块中的web.config文件(<一个href=\"http://stackoverflow.com/a/16577694/1030925\">http://stackoverflow.com/a/16577694/1030925)

  • <modules runAllManagedModulesForAllRequests="true"/>
  • Trying to apply the Microsoft hotfix for extensionless urls (found at http://support.microsoft.com/kb/980368) (Did not help, service pack 1 includes it already)
  • Ensuring that HTTP Errors, HTTP Redirection, and Static Content are added to the role services (http://stackoverflow.com/a/4264564/1030925)
  • Running the command aspnet_regiis -iru
  • Ensuring the bitness of the application is correct (Any CPU)
  • Toggling enabling of 32-bit applications
  • Toggling between classic and integrated mode
  • Ensuring that 'allow unlisted file name extensions' is checked (http://stackoverflow.com/a/5155322/1030925)
  • Ensuring that the ExtensionlessUrlHandler mappings were intact
  • Ensuring that my startup code was in Application_Start and not something else
  • Ensuring folder permissions to the ApplicationPoolIdentity (it can serve static content)
  • Re-adding the UrlRoutingModule-4.0 module in the web.config (http://stackoverflow.com/a/16577694/1030925)

今天上午我停止了网站,停止了应用程序池,不接触任何东西重新部署,并... ...它的作品!不过......如果我在配置触摸这么多,因为一个小东西,无论是使用FileZilla中或远程桌面上的IIS控制台,站点吹起来,开始演技再次这样。只有通过停止该网站并更换所有的文件都在一起我能找回来了 - 尝试过停止和更换web.config中,但没有奏效。这种变化可以禁用和重新启用我的'重定向到https重写规则一样简单。

This morning I stopped the site, stopped the app pool, redeployed without touching anything, and... it works! BUT... if I touch so much as one little thing in the config, whether using FileZilla or the IIS console on the remote desktop, the site blows up and start acting that way again. Only by stopping the site and replacing all the files together have I been able to get it back up -- tried just stopping and replacing the web.config but that did not work. The change can be as simple as disabling and re-enabling my 'redirect to https' rewrite rule.

这好像问题是,我的路线停止工作时,应用程序池被回收,无论是文件更改或明确的重启。我注册一样以同样的方式作为项目模板分两路,使用的Application_Start和的RegisterRoutes。我不明白为什么这是行不通的,如果是在标准的项目模板...

It seems as though the problem is that my routes stop working when the app pool is recycled, whether by file change or explicit restart. I am registering like two routes in the same way as the project template, using Application_Start and RegisterRoutes. I don't understand why this is not working if it's in the standard project template...

推荐答案

的问题与我的发布设置。我用下面的precompile选项在Visual Studio 2012:

The problem was with my publish settings. I was using the following precompile options in Visual Studio 2012:

通过选择不合并或​​所有输出合并到一个单一的程序集,这个问题得到了缓解。

By selecting 'do not merge' or 'merge all outputs to a single assembly', the problem was alleviated.

更新:

问题恢复甚至与其他设置,它只是没有马上发生。我不得不完全禁用precompiling。

The problem resumed even with the other settings, it just didn't happen right away. I had to disable precompiling altogether.

这篇关于MVC应用程序航线池回收(更新标题14年3月3日)后会丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆