【发布时间】:2014-06-21 21:15:55
【问题描述】:
关于这个帖子:404 Not found 我在 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>
和
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}");
}
}
当我取消注释第二个 system.webServer 标记时,我只会从 api 路由中获得 HandlerNotFound 异常。当我删除 web.config 中的位置标签时,会发生同样的错误。
就像现在一样,它可以工作......
任何澄清的帮助表示赞赏, 谢谢诺伯特
【问题讨论】:
标签: servicestack