Javascript IIS 7.5 没有图像 css js 显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3771831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 06:04:58  来源:igfitidea点击:

IIS 7.5 no images css js showing

javascriptcssimageiis-7.5

提问by dm80

I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine.

我有 2 个带有共享配置的 Windows 2008 R2 x64 服务器 NLB、ARR。我在网络共享中有应用程序文件。ASP.net 页面 (.aspx) 运行良好,但没有 css、images、js 工作。我也有一个 .htm 文件显示 css 和图像就好了。

In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise.

在 iis 日志中,我确实看到了 401.3 消息。所以它似乎是权限,但不确定还有什么可以明智地配置权限。

I read similiar issues at:

我在以下位置阅读了类似的问题:

MVC + IIS7 = CSS Issue

MVC + IIS7 = CSS 问题

https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322

https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322

https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied

https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied

I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!

我尝试了建议的解决方案 - 似乎都不起作用(除非我错过了一些东西)。任何意见是极大的赞赏!

回答by dm80

Okay here's what I did to resolve my issue.

好的,这就是我为解决问题所做的工作。

  1. Since my app files are in a file share the Anonymous user account couldn't access them. This is because by default IUSR account is used for Anoymous user. In IIS->Site->Authentication set Anonymous Authentication to Application Pool Identity if you have created a custom app pool OR you can specify an account.

  2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename*" FullTrust -exclusive on

  1. 由于我的应用程序文件位于文件共享中,因此匿名用户帐户无法访问它们。这是因为默认情况下 IUSR 帐户用于 Anoymous 用户。如果您创建了自定义应用程序池,或者您可以指定一个帐户,请在 IIS->站点->身份验证中将匿名身份验证设置为应用程序池标识。

  2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename*" FullTrust -exclusive on

回答by rho

For future solution-searchers having the same or similar problem... I had the same (or similar) problem with my little asp web app. But used this solution, which worked instantly:

对于未来遇到相同或类似问题的解决方案搜索者......我的小 ASP Web 应用程序遇到了相同(或类似)的问题。但是使用了这个解决方案,它立即起作用:

The solution for me was to install the “Static Content” support for IIS.

  1. Go to “Turn Windows features on or off”
  2. Select Internet Information Services
  3. Select World Wide Web Services
  4. And check Static Content

我的解决方案是为 IIS 安装“静态内容”支持。

  1. 转到“打开或关闭 Windows 功能”
  2. 选择 Internet 信息服务
  3. 选择万维网服务
  4. 并检查静态内容

Source: http://www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/

来源:http: //www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/

回答by Tony

In my case, I had the <staticContent>tag in the web.configfile. I had to comment it, run the project (then all css, js, images loaded), uncomment it and run the project again, somehow it worked...

就我而言,我<staticContent>web.config文件中有标签。我不得不评论它,运行项目(然后加载所有 css、js、图像),取消注释并再次运行项目,不知何故它起作用了......

回答by Socratees Samipillai

In addition to Authentication and all the other issues mentioned above, check your web application's Handler Mappings in IIS. The culprit could be a catch-all * handler hiHymaning your .css and .js requests.

除了身份验证和上面提到的所有其他问题,请检查您的 Web 应用程序在 IIS 中的处理程序映射。罪魁祸首可能是一个包罗万象的 * 处理程序劫持了您的 .css 和 .js 请求。

In my case I recently installed ColdFusion on one of our servers and that added managed handlers to IIS making all the requests to asset files to throw a 500 Internal Server Error. I disabled that handler and everything went back to normal.

就我而言,我最近在我们的一台服务器上安装了 ColdFusion,并将托管处理程序添加到 IIS,从而使所有对资产文件的请求引发 500 内部服务器错误。我禁用了该处理程序,一切都恢复正常。

回答by Tyler Forsythe

For me, the issue was with this part of my web.config:

对我来说,问题出在我的 web.config 的这一部分:

  <authentication mode="Forms">
      <forms timeout="2880" loginUrl="/Home?expired=true" 
           requireSSL="false" protection="All" cookieless="UseCookies" />
  </authentication>

I had to change requireSSL from true to false when running under local host without https. Boom, CSS and images showed up.

在没有 https 的本地主机下运行时,我不得不将 requireSSL 从 true 更改为 false。Boom、CSS 和图像出现了。

回答by JP Hellemons

I forgot the permissions. https://serverfault.com/a/260778/30695Had to add IIS_IUSRSwith read permissions.

我忘记了权限。 https://serverfault.com/a/260778/30695必须添加IIS_IUSRS读取权限。