无法在 Web 服务器上启动调试。无法启动 Asp.Net 调试

发布于 2024-11-30 13:05:10 字数 2432 浏览 1 评论 0原文

我在 web.config 中设置了一些 url 重写规则。他们是:

<rewrite>
        <rules>

            <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
                <match url="^(.*)\.aspx$"/>
                <conditions>
                    <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true"/>
                    <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$"/>
                </conditions>
                <action type="Redirect" url="{R:1}/{C:1}/{C:2}" appendQueryString="false"/>
            </rule>
            <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                <match url="^(.*)/([^/]+)/([^/]+)/?$"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx?{R:2}={R:3}"/>
            </rule>
            <rule name="RedirectUserFriendlyURL2" stopProcessing="true">
                <match url="^(.*)\.aspx$"/>
                <conditions>
                    <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true"/>
                </conditions>
                <action type="Redirect" url="{R:1}" appendQueryString="false"/>
            </rule>
            <rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                <match url="^(.*)$"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx"/>
            </rule>
        </rules>
    </rewrite>

所有这些都很好,我确信这一点。但是,当我使用 F5 调试应用程序时,出现错误“无法在 Web 服务器上启动调试。无法启动 Asp.Net 调试。”不知道为什么会发生这种情况。如果我使用 Ctrl + F5 在发布模式下运行它,效果会很好。谁能告诉我为什么会发生这种情况?如果我只是删除这些规则,然后按 F5,它也能工作。我尝试用谷歌搜索这个问题并找到了一个链接。但它对我不起作用:

http://forums.asp.net/t/ 1649452.aspx/1

在上面的链接上,有人要求将大写开头的表单重命名为小写。很有趣!有人要求更改项目类型以使用 .Net Framework 3.5

I have few url rewriting rules set up in my web.config. They are:

<rewrite>
        <rules>

            <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
                <match url="^(.*)\.aspx$"/>
                <conditions>
                    <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true"/>
                    <add input="{QUERY_STRING}" pattern="^([^=&]+)=([^=&]+)$"/>
                </conditions>
                <action type="Redirect" url="{R:1}/{C:1}/{C:2}" appendQueryString="false"/>
            </rule>
            <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                <match url="^(.*)/([^/]+)/([^/]+)/?$"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx?{R:2}={R:3}"/>
            </rule>
            <rule name="RedirectUserFriendlyURL2" stopProcessing="true">
                <match url="^(.*)\.aspx$"/>
                <conditions>
                    <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true"/>
                </conditions>
                <action type="Redirect" url="{R:1}" appendQueryString="false"/>
            </rule>
            <rule name="RewriteUserFriendlyURL2" stopProcessing="true">
                <match url="^(.*)$"/>
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx"/>
            </rule>
        </rules>
    </rewrite>

All these works fine and I am sure about it. However when I debug the application using F5, I get the error "Unable to start debugging on the web server. Could not start Asp.Net debugging." Don't know why is this happening. If I run it in release mode using Ctrl + F5 it works out pretty well. Can anybody tell me why is this happening? If i just remove these rules and then F5 it, it works as well. I tried to google up this issue and came up with one link. But it doesn't work for me:

http://forums.asp.net/t/1649452.aspx/1

On the above link someone ask to rename the forms starting with upper case to lower case. Pretty funny! and somebody asks to change project type to use .Net framework 3.5

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮色兮凉城 2024-12-07 13:05:10

只需将起始页设置为不被规则重写的页面即可。

如果这不起作用,请在规则中添加一些条件以排除脚本文件。
您也可以看看这个问题:

添加 IIS UrlRewrite 似乎会破坏本地 IIS 服务器上的调试

Just set your start page to a page that is not beeing rewritten by the rules.

If that does not work, add some conditions to your rules to exclude script files.
You might also have a look at this question:

Adding IIS UrlRewrite seems to break debugging on local IIS server

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文