如何在服务器端IIS 7 Windows 7 Server上配置UrlRewritingNet

zka*_*oca 2 asp.net iis-7 url-rewriting windows-7

我在完成测试后完成了一个ASP.NET网站.

我正在使用来自http://www.urlrewriting.net/的 UrlRewritingNet dll

然后我发布了它以便上传我的服务器(Windows 7,安装了IIS 7).输入我的网站的URL后,我得到404 - 未找到错误.这是因为服务器端的配置丢失或不良.但我不知道该怎么做.

搜索了很多次,但找不到任何接近我的问题.

我是最后一次机会.你能帮我吗?

您可以在以下内容中查看我的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>
Run Code Online (Sandbox Code Playgroud)

这是我的新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}&amp;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}&amp;opID={R:2}&amp;pmID={R:3}&amp;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}&amp;opID={R:2}&amp;pmID={R:3}&amp;DersID={R:4}&amp;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>
Run Code Online (Sandbox Code Playgroud)

当我输入我的网址时,地址栏中填充了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....
Run Code Online (Sandbox Code Playgroud)

然后浏览器显示错误消息:

无效的重定向网址

小智 10

尝试添加:

<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter"/>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
Run Code Online (Sandbox Code Playgroud)

到配置> system.webserver> modules中的web.config.