简体   繁体   English

WCF Restful服务未将响应发送到Web客户端

[英]WCF Restful service not sending response to web client

I am using MVC5, WebAPI, WCF Restful service in my web application. 我在Web应用程序中使用MVC5,WebAPI,WCF Restful服务。

When I rum WCF restful service I get mixed response. 当我朗读WCF宁静的服务时,我会得到不同的响应。 Some services gives me appropriate response and some not. 有些服务给了我适当的响应,有些则没有。 I am running this application on my machine. 我正在我的机器上运行此应用程序。

I used Fiddler to debug the service. 我使用Fiddler调试服务。

Success: 成功:

localhost/UserRestService.svc/api/GetMembership/23

Failure: localhost/UserRestService.svc/api/GetUserProfile/xyz@gmail.com 失败:localhost/UserRestService.svc/api/GetUserProfile/xyz@gmail.com

Error: [Fiddler] ReadResponse() failed: The server did not return a response for this request. 错误:[Fiddler] ReadResponse()失败:服务器未返回对此请求的响应。 Server returned 0 bytes. 服务器返回了0个字节。

I am not able to understand this error. 我无法理解此错误。 I googled it and could not resolve this error. 我用谷歌搜索,无法解决此错误。

Please help. 请帮忙。

Code: 码:

WCF Service Interface: WCF服务接口:

    [OperationContract]
    [WebGet(UriTemplate = "/api/GetUserProfile/{userName}",RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    // UserProfiles 
    UserProfile GetUserProfile(string userName);

Fiddler raw request 提琴手原始请求

GET localhost:37181/UserRestService.svc/api/GetUserProfile/abc@gmail.com HTTP/1.1
Host: localhost:37181
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Cookie: _gauges_unique_year=1; _gauges_unique=1; lang=auto; __RequestVerificationToken=XCXv18_vpGu9UO4wian60eLRZqUQi6_

您将需要转义@符号,它在URI中具有保留的含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM