经过测试,我已经完成了一个ASP.NET网站。
我正在从http://www.urlrewriting.net/使用UrlRewritingNet dll
然后,我发布了它以便上载服务器(已安装Windows 7,IIS 7)。输入网站的网址后,出现404-Not found错误。这是因为服务器端缺少配置或配置错误。但是我不知道该怎么做。
搜索了很多次,但是找不到任何与我的问题相近的东西。
最后一次机会,我在这里。你能帮我吗?
您可以在下面看到我的web.config内容:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="urlrewritingnet" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
</httpModules>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<remove name="PageHandlerFactory-ISAPI-4.0_32bit"/>
<add name="PageHandlerFactory-ISAPI-4.0_32bit" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/>
<add name="reww" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
<add name="rewwibu" path="*.ibu" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32"/>
</handlers>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<urlrewritingnet configSource="ExternalRewrite.config"/>
</configuration>
这是我的新Web.Config文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<rewrite>
<rules>
<rule name="GoAnasayfa">
<match url="^([_0-9a-z-]+)/Anasayfa.ibu" ignoreCase="false" />
<action type="Rewrite" url="Default.aspx?lang={R:1}" appendQueryString="false" />
</rule>
<rule name="GoIletisim">
<match url="^([_0-9a-z-]+)/Iletisim.ibu" ignoreCase="false" />
<action type="Rewrite" url="Contact.aspx?lang={R:1}" />
</rule>
<rule name="GoDereceProgramlari">
<match url="^([_0-9a-z-]+)/DereceProgramlari/([_0-9a-z-]+).ibu" ignoreCase="false" />
<action type="Rewrite" url="DegreePrograms.aspx?lang={R:1}&derece={R:2}" />
</rule>
<rule name="GoOgrenci">
<match url="^([_0-9a-z-]+)/Ogrenci.ibu" ignoreCase="false" />
<action type="Rewrite" url="Ogrenci.aspx?lang={R:1}" />
</rule>
<rule name="GoKatalog">
<match url="^([_0-9a-z-]+)/([0-9]+)/([0-9]+)/([0-9])/Katalog.ibu" ignoreCase="false" />
<action type="Rewrite" url="Catalog.aspx?lang={R:1}&opID={R:2}&pmID={R:3}&oid={R:4}" />
</rule>
<rule name="GoDersDetay">
<match url="^([_0-9a-z-]+)/([0-9]+)/([0-9]+)/([0-9])/([0-9])/DersAyrintilari.ibu" ignoreCase="false" />
<action type="Rewrite" url="CourseDetail.aspx?lang={R:1}&opID={R:2}&pmID={R:3}&DersID={R:4}&dersKodu={R:5}" />
</rule>
<rule name="GoLLPKoordinatorleri">
<match url="^([_0-9a-z-]+)/LLPKoordinatorleri.ibu" ignoreCase="false" />
<action type="Rewrite" url="Coordinators.aspx?lang={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
当我键入Web地址时,地址栏会填充lang参数,如下所示:
http://somedomain.com/tr-TR/Anasayfa.ibu?lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr&lang=tr-tr....
然后浏览器显示错误消息:
无效的重定向网址
最佳答案
为什么不使用Microsoft的URL重写模块?
http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module
确保根据系统设置安装正确的版本。然后,您可以继续创建重写规则,如下所示:
http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
关于asp.net - 如何在服务器端IIS 7 Windows 7 Server上配置UrlRewritingNet,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16688561/