C# WCF Restful服务未向web客户端发送响应
我在我的web应用程序中使用MVC5、WebAPI、WCF Restful服务 当我使用WCF restful服务时,会得到混合响应。有些服务给了我适当的回应,有些则没有。我正在我的机器上运行此应用程序 我使用Fiddler调试服务 成功:C# WCF Restful服务未向web客户端发送响应,c#,asp.net,wcf,rest,asp.net-web-api,C#,Asp.net,Wcf,Rest,Asp.net Web Api,我在我的web应用程序中使用MVC5、WebAPI、WCF Restful服务 当我使用WCF restful服务时,会得到混合响应。有些服务给了我适当的回应,有些则没有。我正在我的机器上运行此应用程序 我使用Fiddler调试服务 成功: localhost/UserRestService.svc/api/GetMembership/23 失败: localhost/UserRestService.svc/api/GetUserProfile/xyz@gmail.com 错误:[Fiddle
localhost/UserRestService.svc/api/GetMembership/23
失败:
localhost/UserRestService.svc/api/GetUserProfile/xyz@gmail.com
错误:[Fiddler]ReadResponse()失败:服务器未返回
对此请求的响应。服务器返回了0个字节
我无法理解这个错误。我用谷歌搜索了一下,无法解决这个错误
请帮忙
代码:
WCF服务接口:
[OperationContract]
[WebGet(UriTemplate = "/api/GetUserProfile/{userName}",RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
// UserProfiles
UserProfile GetUserProfile(string userName);
小提琴手原始请求
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中具有保留含义。如果在服务代码中放置断点,会发生什么?有人给服务打电话吗?另外,您还看到:@rmayer06:当我在服务上放置断点时,它会给出适当的响应。但在最后,浏览器向我显示了上述错误。@Zaki:我添加了代码……在您的服务和返回web服务之间发生了一些事情。可能是序列化错误?你有微软的源代码吗?你能在你的代码之后一步一步地完成代码吗?