2012-09-07 47 views
3

我在IIS 7.5上运行的应用程序ServiceStack,与/auth/credentials服务定制CredentialsAuthProvider。ServiceStack证书身份验证的端点提供了404

它可以从Visual Studio很好,但是当我在生产服务器上安装它(也IIS 7.5),它响应404的所有请求/auth/credentials。它没有任何麻烦的服务端点REST,如果我改变供应商的超类BasicAuthProvider认证工作,但我想用的形式,而不是基本身份验证。我如何才能正确地提供auth端点?

这是我的web.config是什么样子:

<?xml version="1.0" encoding="UTF-8"?> 

<configuration> 
    <location path="auth"> 
    <system.web> 
     <customErrors mode="Off"/> 
     <httpHandlers> 
     <add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> 
     </httpHandlers> 
    </system.web> 
    </location> 
    <location path="rest"> 
    <system.web> 
     <httpHandlers> 
     <add path="*" 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> 

    <!-- Required for MONO --> 
    <system.web> 
    <httpHandlers> 
     <add path="rest*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> 
     <add path="auth*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*"/> 
    </httpHandlers> 
    </system.web> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
     <httpErrors errorMode="DetailedLocalOnly"> 
      <remove statusCode="403" subStatusCode="-1" /> 
      <error statusCode="403" prefixLanguageFilePath="" path="https://nearme.solarcity.com" responseMode="Redirect" /> 
     </httpErrors> 
    <!--<modules runAllManagedModulesForAllRequests="true"> 
     <remove name="WebDAVModule" /> 
    </modules>--> 
    <!--uncomment this to stop IIS 7.5 from blocking PUT and DELETE--> 
    </system.webServer> 
</configuration> 

回答

3

你在你的配置做出错误的假设。

只能在一个单一路径这是在根目录路径*或一般是按照惯例要么/api/servicestack但也可以是您选择的任何名称自定义路径主机ServiceStack。 HelloWorld教程shows an example configuration for both supported options

认证过程装饰任一方请求DTO或服务与[身份验证]属性执行。如果您愿意,您还可以将该属性添加到自定义基类,例如AuthenticatedServiceBase这将确保所有的子类都需要认证。

+2

+1,尝试建立ServiceStack应用程序在使用MonoDevelop的,而不是Visual Studio中的。它并不隐藏这样的东西。 –

+0

谢谢!我将ServiceStack设置为从根路径主持,调整了一些端点,现在一切正常。 – Phssthpok