1

Regarding to this thread: 404 Not found I still have this issue on Win 8.1 - VS 2013-1

<!--<system.webServer>
   <validation validateIntegratedModeConfiguration="false" />
</system.webServer>-->
<location path="api">
<system.web>
  <httpHandlers>
    <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" />
  </httpHandlers>
</system.web>

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

and

public class HelloAppHost : AppHostBase
{

        /// <summary>
        /// Initializes a new instance of your ServiceStack application, with the specified name and assembly containing the services.
        /// </summary>
        public HelloAppHost() : base("Hello Web Services", typeof(HelloService).Assembly) { }

        /// <summary>
        /// Configure the container with the necessary routes for your ServiceStack application.
        /// </summary>
        /// <param name="container">The built-in IoC used with ServiceStack.</param>
        public override void Configure(Container container)
        {
            //Register user-defined REST-ful urls. You can access the service at the url similar to the following.
            //http://localhost/ServiceStack.Hello/servicestack/hello or http://localhost/ServiceStack.Hello/servicestack/hello/John%20Doe
            //You can change /servicestack/ to a custom path in the web.config.
            SetConfig(new HostConfig
            {
                HandlerFactoryPath = "api"
            });
            SetConfig(new HostConfig { DebugMode = true });

            Routes
              .Add<Hello>("/hello")
              .Add<Hello>("/hello/{Name}");
        }

}

When I uncomment the second system.webServer tag, I only get HandlerNotFound Exceptions from the api route. When I remove the location tag in web.config the same errors occur.

Like it is now it works ...

Any help for clarification appreciated, thanks Norbert

Community
  • 1
  • 1
nhaberl
  • 417
  • 1
  • 4
  • 17

1 Answers1

1

You need to change the following:

SetConfig(new HostConfig
{
    HandlerFactoryPath = "api"
});
SetConfig(new HostConfig { DebugMode = true });

to

SetConfig(new HostConfig
{
   HandlerFactoryPath = "/api",
   DebugMode = true
};

Just a guess, but your second instance of HostConfig is probably overriding the first one.

Kevin
  • 71
  • 3