Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

404 after upgrading ServiceStack from 3.9.8 to 3.9.70 (new API)

We've been using a legacy version (3.9.8) of ServiceStack for a while now and I decided to try an upgrade to the latest version (3.9.70) and while it was a clean, no hassle package upgrade - everything compiles and runs - every service URL now returns a "Handler for Request not found" 404 result.

An example of a URL that used to work:

http://somewebserver.com/services/servicestack/jsv/syncreply/getuser

We use the old API (IService<T>) and make no use of REST routes or anything of the sort.

The ServiceStack application runs inside an ASP.NET MVC 3 web application, which lives on the URL http://somewebserver.com/management/controller/action. It doesn't seem like it's interfering as it's been configured to ignore the ServiceStack route:

routes.IgnoreRoute("servicestack/{*pathInfo}");

The ServiceStack code is definitely running as going to http://somewebserver.com/services/servicestack redirects me to the metadata page, which works.

I've tried following these steps:

https://github.com/ServiceStack/ServiceStack/wiki/Run-servicestack-side-by-side-with-another-web-framework

But it doesn't seem to make a difference.

What I changed in the config to try and make this work:

1) Removed this old line in system.webServer/handlers

<add path="servicestack" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />

2) Added this location section:

<location path="servicestack">
<system.web>
  <httpHandlers>
    <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/>
  </httpHandlers>
</system.web>

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

3) Added this in the app host setup:

this.Config.ServiceStackHandlerFactoryPath = "servicestack";

Calling the URL fails for both POST and GET, which used to both work.

This is all running under IIS 8.

I'd love to know what's going on here, so we can finally upgrade and live in 2013 :)

like image 986
JulianR Avatar asked Nov 16 '13 04:11

JulianR


1 Answers

Apparently, the fix was in how we enabled the ServiceStack features. I didn't make the change myself, but these are the fixes:

Removed from AppHost:

this.Config.EnableFeatures = Feature.Metadata | Feature.Jsv | Feature.Json;
this.Config.ServiceStackHandlerFactoryPath = "servicestack";

Replaced by:

Feature disableFeatures = Feature.Soap;
SetConfig(new EndpointHostConfig
{
  ServiceStackHandlerFactoryPath = "servicestack",
  EnableFeatures = Feature.All.Remove(disableFeatures),
  DebugMode = false,
  WriteErrorsToResponse = false,
  DefaultContentType = ContentType.Jsv,
  AllowJsonpRequests = false
});
like image 180
JulianR Avatar answered Nov 06 '22 19:11

JulianR