2013-01-10 218 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); 
相關問題