看一看的MVC Integration文档,显示如何配置ServiceStack,以便它可以与其他web框架,例如配置你可以注册ServiceStack被安装在/api/v2
:
<location path="api/v2">
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack"
verb="*"/>
</httpHandlers>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory"
type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*"
preCondition="integratedMode"
resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
</location>
您还需要在您的ServiceStack的AppHost.Configure()
指定它:
SetConfig(new HostConfig {
HandlerFactoryPath = "api/v2"
});
谢谢,它解决了我的问题! – Eugene