无法在Web服务器上开始调试。无法启动Asp.Net调试
问题描述:
我有几个url重写规则在我的web.config中设置。它们是:无法在Web服务器上开始调试。无法启动Asp.Net调试
<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>
所有这些作品很好,我相信它。但是,当我使用F5调试应用程序时,出现错误“无法在Web服务器上启动调试,无法启动Asp.Net调试。”不知道为什么会发生这种情况。如果我使用Ctrl + F5在释放模式下运行它,它会很好地工作。有人可以告诉我为什么会发生这种情况?如果我只是删除这些规则,然后F5它,它也可以。我试图谷歌这个问题,并提出了一个链接。但它不为我工作:
http://forums.asp.net/t/1649452.aspx/1
在上面的链接有人要求重新命名的形式以大写字母开始小写。挺滑稽的!并有人问改变项目类型使用.NET Framework 3.5的
答
只需将您的起始页面设置为不受规则重写的页面即可。
如果这不起作用,请向规则添加一些条件以排除脚本文件。 您可能还会看到这个问题:
Adding IIS UrlRewrite seems to break debugging on local IIS server