The handler for the request was not found:

I am creating a service stack for the first time: hello world.

I followed step by step in here :

but this gives me an error: the handler for the request was not found: what could be the missing part? thanks.

here is my global.asax.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.SessionState; using ServiceStack.ServiceHost; using ServiceStack.WebHost.Endpoints; namespace ServiceStack.SearchService { public class Global : System.Web.HttpApplication { public class Hello { public string Name { get; set; } } public class HelloResponse { public string Result { get; set; } } public class HelloService : IService<Hello> { public object Execute(Hello request) { return new HelloResponse { Result = "Hello, " + request.Name }; } } /// Web Service Singleton AppHost public class HelloAppHost : AppHostBase { //Tell Service Stack the name of your application and where to find your web services public HelloAppHost() : base("Hello Web Services", typeof(HelloService).Assembly) { } public override void Configure(Funq.Container container) { } } protected void Application_Start(object sender, EventArgs e) { //Initialize your application var appHost = new HelloAppHost(); appHost.Init(); } void Application_End(object sender, EventArgs e) { // Code that runs on application shutdown } void Application_Error(object sender, EventArgs e) { // Code that runs when an unhandled error occurs } void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started } void Session_End(object sender, EventArgs e) { // Code that runs when a session ends. // Note: The Session_End event is raised only when the sessionstate mode // is set to InProc in the Web.config file. If session mode is set to StateServer // or SQLServer, the event is not raised. } } } 

here is my web.config:

 <?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <connectionStrings> <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.0" /> <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> <membership> <providers> <clear /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <profile> <providers> <clear /> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" /> </providers> </profile> <roleManager enabled="false"> <providers> <clear /> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> </providers> </roleManager> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> <add path="api*" 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 path="servicestack"> <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" /> <add path="servicestack*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> </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> </configuration> 

I view it by typing in the browser.

 http://localhost:50097/ServiceStack.SearchService/servicestack/metadata 
+8
web-services servicestack servicestack-bsd
source share
3 answers

It looks like you are trying to place a ServiceStack both on the root path / , and as a combination of /servicestack and /api custom paths. You need to choose one of them, and not a combination of all 3. Here is the configuration if you want to place on the / root path :

 <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> </system.web> <!-- Required for IIS 7.0 --> <system.webServer> <handlers> <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> </handlers> </system.webServer> 

The above should replace any other ServiceStack configuration mapping. After that, you can view the metadata page at:

http://localhost:50097/metadata

Note. If you use ASP.NET on a port, it is unlikely that you also have a path to the /ServiceStack.SearchService/ virtual directory.

+7
source share

There is a small step in this list that you need if you intend to map services to a custom path. You can find it here :

To quote the missing step:

You also need to configure the root path in AppHost.

 public override void Configure(Container container) { SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" }); } 

Where "api" is the name of the custom path you are using.

+11
source share

I had this exact problem that I ran into and could not find a direct answer - get error 403.14 on a simple demo of ServiceStack.

..:: Simple answer::..

Your answer is simple. You confuse your handlers by providing 3 instead of one, as mentioned in Mythz. In addition, you do not have the specified route for your request.

 [Route("/hello")] public class Hello { public string Name { get; set; } } 

This will fix your 403.13 error (semantic problem), and you can go to your http: // {localdomain}: {port} / hello and see the metadata (replace {port} with the actual IIS Express port number assigned to you). Without this setting, you need to go to http: // {localdomain}: {port} / metadata.

..:: Detailed response::..

Routing, as it relates to IIS in ServiceStack, is done through semantics / conventions. Since these routes are dynamic, when IIS does not provide proper routing at runtime, it assumes that there is a problem with the folder (physical path) and throws error 403.14. At the same time, if you provide more than one path where there should be only one, bad things happen at runtime when everything is connected.

To make sure that you have everything you need, here are all the settings you need to make in the source code.

but. Adjust your web configuration file to handle only one path, as described in Mythz's answer.

 <system.web> <httpHandlers> <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> </httpHandlers> </system.web> <!-- Required for IIS 7.0 --> <system.webServer> <handlers> <add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> </handlers> </system.webServer> 

b. Make the route setup described earlier in this post.

+2
source share

All Articles