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

Jos*_*ice 5 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>
Run Code Online (Sandbox Code Playgroud)

更新:

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

paa*_*hpa 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>
Run Code Online (Sandbox Code Playgroud)

我将 .aspx 添加到我的路由中,以便访问 ASP.NET(我想您也可以使用上面链接中列出的其他解决方案)

Routes
.Add<Hello>("/hello.aspx")
.Add<Hello>("/hello.aspx/{Name}");
Run Code Online (Sandbox Code Playgroud)

我可以向以下人员提出请求http://localhost/hello.aspx and http://localhost/hello.aspx?name=Test

更新1

事实证明,<system.webServer>在经典模式下运行时,我可以删除所有 IIS 7 ( ) 元素。我的整个 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>
Run Code Online (Sandbox Code Playgroud)

评论回复:

因此,这在功能上等同于您的示例中的 path="api*" 吗?

否。请参阅此处: http: //msdn.microsoft.com/en-us/library/b6x6shw7%28v=vs.100%29.aspx 请参阅此处的第 2 节: http: //www.servicestack.net/ ServiceStack.Hello/元素<httpHandler>具有自定义路径的路径属性。

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