2013-01-14 40 views
1

有人可以從中瞭解發生了什麼嗎?我有一個使用VS 2010創建的網站。在添加httpModule時,以下代碼默認由VS添加。當我通過Casseni運行應用程序時,突出顯示的行會引發錯誤「此操作需要IIS集成管道模式」。正在接收'此操作需要IIS集成管道模式。'向VS web項目添加httpModule時出錯

public void Init(HttpApplication context) 
    { 
     // Below is an example of how you can handle LogRequest event and provide 
     // custom logging implementation for it 
     **context.LogRequest += new EventHandler(OnLogRequest);** 
    } 

    #endregion 

    public void OnLogRequest(Object source, EventArgs e) 
    { 
     //custom logging logic can go here 
    } 

我的web.config文件被更新爲這樣:

<configuration> 
<system.web> 
    <compilation debug="true" targetFramework="4.0" /> 

    <httpModules> 
    <add name="GlobalModule" type="MyApp.Global.GlobalModule, EduCarePro"/> 
    </httpModules> 

</system.web> 

<system.webServer> 
<modules> 
    <remove name="GlobalModule"/> 
    <add name="GlobalModule" type="MyApp.Global.GlobalModule, EduCarePro" preCondition="managedHandler"/> 
</modules> 
</system.webServer> 

有沒有別的東西,必須在web.config防止這種錯誤配置?

回答

1

此問題的答案是Visual Studio的開發Web服務器不支持此功能。您必須在運行IIS的計算機上運行此代碼。

取自(並且工作對我來說,因爲我有同樣的問題)

Link

相關問題