webconfig中註冊HttpHandler報錯:檢測到在整合的託管管道模式下不適用的 ASP.NET 設定。

來源:互聯網
上載者:User

標籤:mode   runtime   asp   jpg   管道   ted   handle   ida   dll   

為什麼會出現以上錯誤?

  在IIS7的應用程式集區有兩種模式,一種是“整合模式”,一種是“傳統模式”。

  傳統模式 則是我們以前習慣的IIS 6 的方式。

  如果使用整合模式,那麼對自訂的httpModules 和 httpHandlers 就要修改設定檔,需要將他們轉移到<modules>和<hanlders>節裡去。

有兩種解決方式:

  第一種方法、配置應用程式集區

  在IIS7上配置應用程式集區,並且將程式池的模式改為“經典”,之後一切正常。

 

第二種:修改設定檔webconfig

修改前:

<configuration>    <system.web>      <httpHandlers>        <add path="*.aspx" verb="*" type="CustomerHander, ClassLibrary1" />      </httpHandlers>      <compilation debug="true" targetFramework="4.5" />      <httpRuntime targetFramework="4.5" />    </system.web></configuration>

 

修改後:

<configuration>  <system.web>    <compilation debug="true" targetFramework="4.5" />    <httpRuntime targetFramework="4.5" />  </system.web>  <system.webServer>    <handlers>      <add name="CustomerHander" path="*.aspx" verb="*" type="CustomerHander, ClassLibrary1" preCondition="integratedMode" />    </handlers>    <validation validateIntegratedModeConfiguration="false" />  </system.webServer></configuration>

項目結構如下:

1.自訂hander是引用的其他類庫,所以type屬性用逗號分割,前面是:全限定類名 後面是:所在的dll檔案(不包括尾碼名)

 

2.如果hander在本項目中,

則web.config檔案中的配置如下:

type屬性只填寫類名就可以了。

 

補充:如果想保留原先設定,更改後可以設定禁止驗證整合模式(validateIntegrateModeConfiguration="false"),是不會產生錯誤的。

webconfig中註冊HttpHandler報錯:檢測到在整合的託管管道模式下不適用的 ASP.NET 設定。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.