cit*_*nas 10 c# asp.net debugging iis-7.5
这一问题已被疯狂的驾驶我:我是工作在最近创建的项目,突然我无法调试具体项目.
我正在使用IIS UrlRewrite 2模块的本地IIS 7.5.我的开发机器是带有Visual Studio 2010 Professional的Windows 7 x64.
在其他项目中进行调试仍然有效.我在本地IIS中设置了一个条目,我开始在我的本地IIS上调试我的ASP.net 4.0项目.
我能够使用URL Rewrite 2模块跟踪调试问题,直到出现意外行为,并使用新创建的4.0 Web应用程序项目重现问题:
在IIS中添加一个简单的URL重写规则与管理设计器后,我无法开始调试,因为我收到错误消息
Unable to start debugging on the web server. Could not start ASP.Net debugging.
More information may be available by starting the project without debugging.
Run Code Online (Sandbox Code Playgroud)
(我也试过从其他项目复制URL-Rewrite设置,到目前为止没有成功)
启动项目而没有调试工作完美,并没有显示任何错误!
除此之外,我只在default.aspx的默认文本中添加了一些字符
IIS中的站点设置:
- 我创建了一个新站点,分配了一个绑定(哪个端口无关紧要,例如我尝试了端口86)就像我一直这样做.
- 我将新创建的应用程序池中的用户标识设置为"networkservice"
- 将新创建的应用程序池的框架版本设置为"4.0"
- 我已将用户的"networkservice"完整目录权限授予解决方案目录
我还尝试了其他几种设置组合,例如启用WindowsAuthentification,FormsAuthentication等等.到目前为止没有运气.
这是项目的Web选项卡:
服务器:使用本地IIS Web服务器,项目URL"http:// localhost:86 /"(我也尝试使用"http:// localhost:86",似乎没有一个区别)
这里发生了什么?我在这里失去了理智.有想法该怎么解决这个吗?(不使用UrlRewrite 2.0模块是没有选择)
最后是web.config:
<?xml version="1.0" encoding="UTF-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<rules>
<rule name="LowerCaseRule1" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
更新:显然我可以使用ActionType ="Rewrite"进行调试,但不能使用ActionType ="Redirect"进行调试.尽管如此,仍然没有真正的选择,因为我希望这个问题在第一次安置时得到修复,而不是在一些解决方法中徘徊.我现在非常想提供赏金,但系统不会让我这么做.
任何人都可以重现我的步骤吗?(到目前为止,我在2台不同的计算机上得到了它
Kir*_*oll 18
Visual Studio在启动时会(由于某种原因)尝试访问URL:
/debugattach.aspx
如果你有一个重写规则,重定向(或以其他方式捕获),比如.aspx文件,在其他地方,那么你将得到这个错误.解决方案是将此部分添加到您web.config的<system.webServer>/<rewrite>/<rules>部分的开头:
<rule name="Ignore Default.aspx" enabled="true" stopProcessing="true">
<match url="^debugattach\.aspx" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
Run Code Online (Sandbox Code Playgroud)
这将确保捕获这一个特定请求,什么都不做,最重要的是,停止执行,这样就不会运行任何其他规则.这是一个强大的解决方案,因此请随意将其保存在配置文件中以进行生产.
问题是所有文件都将被迫使用规则,除非它们被条件明确排除。我附近没有源代码,但我想这可以解决问题:
<conditions>
<add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
</conditions>
Run Code Online (Sandbox Code Playgroud)
LowerCaseRule 条目应如下所示:
<rule name="LowerCaseRule1" enabled="true" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false"/>
<conditions>
<add input="{URL}" matchType="Pattern" pattern="^.+\.((axd)|(js)|(xaml))$" ignoreCase="true" negate="true"/>
</conditions>
<action type="Redirect" url="{ToLower:{URL}}"/>
</rule>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3875 次 |
| 最近记录: |