I have written an API using ServiceStack to retrieve documents from my SharePoint document library and I am using MVC to output the result.
However when I try and run my application I am receiving a HTTP error:
500.21 ServiceStack.Factor has a bad module "ManagedPipelineHandler" in its module list error
I am running my application in classic mode in IIS as I need to use impersonation to authenticate with my SharePoint server.
There seems to be a difficulty with using ServiceStack in classic mode.
How can I resolve this error?
I hope this makes sense.
Any help will be appreciated
Here is my configuration:
<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>
Update:
Running my application as a different user on my dev machine works fine the issue seems to be a difference between IIS and the ASP.NET Development Server
I don't think classic mode can handle the route configurations. As stated here - http://www.asp.net/mvc/tutorials/older-versions/deployment/using-asp-net-mvc-with-different-versions-of-iis-cs - You do need to perform additional configuration when using IIS 7.0 in classic mode or use a file extension that gets mapped to ASP.NET framework (aspx, axd, ashx).
I was able to get classic mode working against IIS 7 using the below configurations
web.config (partial and using 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>
And I added .aspx to my routes in order to hit ASP.NET (I would imagine you could us the other solutions listed in the link above as well)
Routes
.Add<Hello>("/hello.aspx")
.Add<Hello>("/hello.aspx/{Name}");
I can make requests to http://localhost/hello.aspx and http://localhost/hello.aspx?name=Test
Update 1
It turns out I can remove all the IIS 7 (<system.webServer>
) elements when running in classic mode. My entire web.config is below. What is the path attribute for your <httpHandlers>
element? Perhaps you are getting a 404 because the path is different?
<?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>
Comment Answers:
Therefore, is this functionally equivalent to path="api*" as in your example?
No. See here: http://msdn.microsoft.com/en-us/library/b6x6shw7%28v=vs.100%29.aspx
Take a look at Section 2 here: http://www.servicestack.net/ServiceStack.Hello/ The <httpHandler>
element has the path attribute for a custom path.
Also, use IIS Express as your development server in Visual Studio. You should be able to simulate the IIS 7 classic mode issues that don't occur within the standard development server. http://www.microsoft.com/web/gallery/install.aspx?appid=IISExpress
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With