CSS未应用于IIS上部署的ASP.NET MVC应用程序

时间:2014-06-02 15:37:40

标签: css asp.net asp.net-mvc iis

Environment:
Visual Studio 2013 
ASP.NET MVC 5 
Windows 8.1 (both dev and deployment server)

我的应用程序使用localhost在Visual Studio环境中按预期显示和执行。

但是,当我部署到我的IIS服务器时,我发现了两个问题(可能是相关的,所以包括这两个)。

Installed as an app on the default site and accessed via http://myMachineName/myApp
1. Page doesn't render correctly. Everything is on the page, but the CSS is not being applied.
2. The code behind does NOT execute.


Installed as a new site and accessed via its port number: http://myMachineName:81
1. Page doesn't render correctly. Everything is on the page, but the CSS is not being applied.
2. The code behind does execute correctly.

2 个答案:

答案 0 :(得分:0)

在每个页面上添加以下内容修复了IE上的UI和功能问题:

<meta http-equiv="x-ua-compatible" content="ie=edge"> 

答案 1 :(得分:0)

遇到了同样的问题。原来这是一个与IIS中静态内容相关的设置。

这是答案的链接: CSS, Images, JS not loading in IIS