2012-12-19 33 views
2

我有一個現有的asp.net網站的作品。當我(F5)調試它的作品。但是,我正在爲該網站開發一個新的IHttpHandler。當我加入<system.webServer><handler></handler></system.webServer>節到web.config視覺工作室拒絕F5調試與錯誤:新的處理程序觸發Visual Studio中的調試失敗

Unable to start debugging on the web server. The web server could not find the requested resource.

有了處理程序,如果我附上到進程的話,我可以成功連接到過程(並與System.Diagnostics.Debugger.Break();線我可以通過處理程序的代碼)。我還將我的處理程序添加到其他網站,並能夠重現此問題。

我的環境:.NET 4.0的Visual Studio 2012,在Windows 7

使用本地IIS集成模式在試圖清理代碼粘貼在這裏,我最終註釋掉我的處理程序之外的所有鍋爐板,問題仍然存在。以下是代碼片段:

的處理程序類:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 

namespace MySvc 
{ 
    public class MyServiceHandler : IHttpHandler 
    { 
     public bool IsReusable 
     { 
      get { return false; } 
     } 

     public void ProcessRequest(HttpContext context) 
     { 
//#if DEBUG 
//   System.Diagnostics.Debugger.Break(); 
//#endif 
     } 
    } 
} 

,並在web.config:

<?xml version="1.0"?> 
<configuration> 
    <appSettings> 
     <clear/> 
     <add key="A1" value="sanitized"/> 
     <add key="A2" value="sanitized"/> 
    </appSettings> 
    <connectionStrings> 
     <clear/> 
     <add name="MyDatabase" connectionString="sanitized"/> 
    </connectionStrings> 
    <system.web> 
     <compilation debug="true"/> 
     <httpRuntime maxRequestLength="1048576" executionTimeout="3600"/> 
     <sessionState mode="SQLServer" cookieless="false" timeout="5" allowCustomSqlDatabase="true" cookieName="My.Session" 
         sqlConnectionString="sanitized" /> 
     <machineKey 
      validationKey="sanitized" 
      decryptionKey="sanitized" 
      validation="sanitized" decryption="sanitized" /> 
    </system.web> 
    <system.webServer> 
     <handlers> 
      <clear /> 
      <add name="MyHandler" path="*.bwsvc" verb="*" type="MySvc.MyServiceHandler, MySvc" /> 
     </handlers> 
    </system.webServer> 
</configuration> 

我已經經歷The Web Server Could Not Find the Requested Resource和許多沿着相同的路線的其他文章閱讀。它似乎沒有適用於這種情況,沒有提到處理程序造成問題。

我是否在我的處理程序中丟失了某些東西,或者這是Visual Studio不支持的或某些其他問題?

回答

0

我發現了這個問題。事實證明,<handlers>部分中的<clear />是導致該問題的原因。只要刪除該行,調試器就會再次運行(還有很多其他的事情)。

由於我的應用程序池處於集成管道模式,處理程序部分實際上是從服務器設置繼承的,這些設置指定處理諸如* .aspx之類的核心內容,所以清除它意味着IIS不知道什麼在我的應用程序。

相關問題