Why does ServiceStack return 404 with this configuration?
servicestack
Solution
The extra `system.webServer` declaration might be interfering with ServiceStack's auto-inferencing of the hosted path from your Web.Config.
You can try to set the path manually to see if that helps, e.g in your AppHost.Configure():
SetConfig(new HostConfig {
HandlerFactoryPath = "services",
});
Problem
I have the following configuration. ``` <location path="services"> <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> </httpHandlers> <authorization> <allow users="*"/> </authorization> </system.web> <!-- Required for IIS 7.0 --> <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> ``` If I add another `<system.webServer />` section, not within a `location` element, ServiceStack returns 404 for all requests. Remove it, and everything works again. Here's an example response: ``` HTTP/1.1 404 Not Found Cache-Control: private Content-Type: text/plain; charset=utf-8 Server: Microsoft-IIS/7.5 X-Powered-By: ServiceStack/3.926 Win32NT/.NET X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Mon, 19 Nov 2012 23:15:46 GMT Content-Length: 1528 Handler for Request not found: Request.ApplicationPath: /MyWebApp.Web.UI Request.CurrentExecutionFilePath: /MyWebApp.Web.UI/services/echo/ Request.FilePath: /MyWebApp.Web.UI/services/echo/ Request.HttpMethod: GET Request.MapPath('~'): D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI Request.Path: /MyWebApp.Web.UI/services/echo/ Request.PathInfo: Request.ResolvedPathInfo: /services/echo Request.PhysicalPath: D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI\services\echo\ Request.PhysicalApplicationPath: D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI\ Request.QueryString: Request.RawUrl: /MyWebApp.Web.UI/services/echo/ Request.Url.AbsoluteUri: http://localhost/MyWebApp.Web.UI/services/echo/ Request.Url.AbsolutePath: /MyWebApp.Web.UI/services/echo/ Request.Url.Fragment: Request.Url.Host: localhost Request.Url.LocalPath: /MyWebApp.Web.UI/services/echo/ Request.Url.Port: 80 Request.Url.Query: Request.Url.Scheme: http Request.Url.Segments: System.String[] App.IsIntegratedPipeline: True App.WebHostPhysicalPath: D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI App.WebHostRootFileNames: [global.asax,global.asax.cs,header.html,list.html,login.html,MyWebApp.web.ui.csproj,MyWebApp.web.ui.csproj.user,packages.config,web.config,bin,humanresources,js,obj,properties,styles,_sgbak] App.DefaultHandler: DefaultHttpHandler App.DebugLastHandlerArgs: GET|/MyWebApp.Web.UI/services/echo/|D:\Lib\MyWebApp\2013\MyWebApp\MyWebApp.Web.UI\services\echo\ ``` Is it not possible to have another `system.webServer` section? I'd like to add IIS url rewriting rules there.