ServiceStack.Factor有一个错误的模块" ManagedPipelineHandler"在其模块列表中

时间:2013-02-25 10:33:56

标签: asp.net-mvc sharepoint servicestack

我使用ServiceStack编写了一个API,用于从我的SharePoint文档库中检索文档,我使用MVC输出结果。

但是当我尝试运行我的应用程序时,我收到一个HTTP错误:

  

500.21 ServiceStack.Factor有一个坏模块" ManagedPipelineHandler"在其模块列表错误

我在IIS中以经典模式运行我的应用程序,因为我需要使用模拟来对我的SharePoint服务器进行身份验证。

在经典模式下使用ServiceStack似乎有困难。

如何解决此错误?

我希望这是有道理的。

任何帮助将不胜感激

这是我的配置:

<system.webServer>
            <modules runAllManagedModulesForAllRequests="true" />
            <validation validateIntegratedModeConfiguration="false" />
            <handlers>
                <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="classicMode" resourceType="Unspecified" allowPathInfo="true" />
            </handlers>
        </system.webServer>

更新

在我的开发机器上以不同的用户身份运行我的应用程序正常工作似乎是IIS与ASP.NET开发服务器之间的区别

1 个答案:

答案 0 :(得分:4)

我不认为经典模式可以处理路由配置。如此处所述 - http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs - 在经典模式下使用IIS 7.0或使用映射到ASP.NET框架(aspx,axd,ashx)的文件扩展名时,需要执行其他配置。

我能够使用以下配置获得针对IIS 7的经典模式

web.config(部分并使用preCondition =“integratedMode”):

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
        <add path="servicestack*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" 
             verb="*" preCondition="integratedMode" />
    </handlers>
</system.webServer>

为了点击ASP.NET,我将.aspx添加到我的路由中(我想你可以使用上面链接中列出的其他解决方案)

Routes
.Add<Hello>("/hello.aspx")
.Add<Hello>("/hello.aspx/{Name}");

我可以向http://localhost/hello.aspx and http://localhost/hello.aspx?name=Test

发出请求

更新1

事实证明,在经典模式下运行时,我可以删除所有IIS 7(<system.webServer>)元素。我的整个web.config如下。您的<httpHandlers>元素的路径属性是什么?也许你得到404因为路径不同?

<?xml version="1.0"?>
<configuration>
    <system.web>
        <httpHandlers>
            <add path="servicestack*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
        </httpHandlers>
        <compilation debug="true"/>
    </system.web>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    </system.webServer>
</configuration>

评论答案:

因此,这在功能上等同于你的例子中的path =“api *”吗?

没有。见这里:http://msdn.microsoft.com/en-us/library/b6x6shw7%28v=vs.100%29.aspx 请在此处查看第2部分:http://www.servicestack.net/ServiceStack.Hello/ <httpHandler>元素具有自定义路径的路径属性。

此外,在Visual Studio中使用IIS Express作为开发服务器。您应该能够模拟标准开发服务器中未出现的IIS 7经典模式问题。 http://www.microsoft.com/web/gallery/install.aspx?appid=IISExpress