2013-01-10 121 views
2

我在.net 4.5中创建了一个基于Rest的服务,并在IIS7中承载了相同的服务。为什么servicestack返回404 Handler for Request未找到错误?

我能击中使用服务HTTP的WebRequest(GET,POST),并得到响应,但通过ServiceStack打时,我得到了以下错误消息,

enter image description here

的代码打在服务栈的API,

IServiceClient serviceClient = new XmlServiceClient("http://localhost/ServerAccessManagerAPI/events"); 
    var response = serviceClient.Send(request); 

我包含在我的服务配置文件中的以下行,

<location> 
    <system.web> 
     <httpHandlers> 
     <add path="*" 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" /> 
     <remove name="WebDAVModule" /> 
     </handlers> 
    </system.webServer> 

    </location> 

任何人都可以帮助我吗? 谢谢。

回答

0

ServiceStack ServiceClients接受基本URI其宜基本URI您所有ServiceStack服务,而不是url到特定的一个。尝试改为:

var serviceClient = new XmlServiceClient("http://localhost/ServerAccessManagerAPI/"); 
var response = serviceClient.Send(request); 
相关问题