首页 文章

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

提问于
浏览
5

我使用 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 回答

  • 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>
    

    我将.aspx 添加到我的路线以便命中 ASP.NET(我想你可以使用上面链接中列出的其他解决方案)

    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>元素的path属性是什么?也许你得到 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 %3在此处查看第 2 节:http://www.servicestack.net/ServiceStack.Hello/ <httpHandler>元素具有自定义路径的 path 属性。

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

相关问题