繁体   English   中英

ASP.net URL重写到不同的域

[英]ASP.net URL rewrite to a different domain

我试图重写为azure中的blob中的url以返回静态html,但它始终指出以下404.4错误:

请求的URL的文件扩展名没有配置为在Web服务器上处理请求的处理程序。

  • 模块:IIS Web Core
  • 通知:MapRequestHandler
  • 处理器:StaticFile
  • 错误代码:0x8007007b

这是我的web.config文件:

  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <httpHandlers>
      <add path="*.html" verb="*" type="System.Web.StaticFileHandler" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <validation validateIntegratedModeConfiguration="false" />

    <staticContent>
      <remove fileExtension=".css" />
      <mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" />
      <remove fileExtension=".js" />
      <mimeMap fileExtension=".js" mimeType="text/javascript; charset=UTF-8" />
      <remove fileExtension=".json" />
      <mimeMap fileExtension=".json" mimeType="application/json; charset=UTF-8" />
      <remove fileExtension=".rss" />
      <mimeMap fileExtension=".rss" mimeType="application/rss+xml; charset=UTF-8" />
      <remove fileExtension=".html" />
      <mimeMap fileExtension=".html" mimeType="text/html; charset=UTF-8" />
      <remove fileExtension=".xml" />
      <mimeMap fileExtension=".xml" mimeType="application/xml; charset=UTF-8" />
    </staticContent>

    <rewrite>
      <rules>
        <rule name="static" stopProcessing="true">
          <match url="static/(.*)" />
          <action type="Rewrite" url="https://www.blobtest.blob.core.windows.net/static/{R:1}" />
        </rule>
      </rules>
    </rewrite>

  </system.webServer> 

我添加了一个httphandler和mimemaps,仍然显示相同的错误。 此外,如果我将重写更改为重定向它可以工作,但这会更改我不想要的网址。

提前致谢。

我今天刚刚遇到了同样的问题,事实证明这是因为URL重写只有在你明确地在同一个站点/ web应用程序中重定向时才有效。 有关解决方案,请参见http://blogs.msdn.com/b/asiatech/archive/2011/08/25/return-404-4-not-found-when-url-rewrite.aspx 提示:您需要安装ARR并在ARR - >服务器代理设置下选中“启用代理”框

希望它会对你有所帮助。 如果为时已晚,从互联网上有这个问题的人数来判断,我相信它会帮助别人

暂无
暂无

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

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