[英]How to debug WCF web service with Android client?
我一直在开发可以互相通信的WCF服务和Android应用程序。在开发中,当我对Web服务进行更改时,我每次都右键单击Web Project-> Publish Web Site来发布服务。耗时的。
我正在使用Visual Studio 2013。
是否可以在不将wcf服务发布为网站的情况下进行调试? 有没有其他方法可以做到这一点。
提前致谢。
绝对可以,您可以在不发布的情况下调试WCF服务。只需在解决方案资源管理器中右键单击.svc文件,然后单击“在浏览器中查看”,即可打开浏览器并使用类似
http:// localhost:3006 / ConsumerServices.svc
然后将此网址提供给您调用的位置。只需在所需的位置放置断点即可。
仅举例来说,我已经使用了Angularjs。
$http({
method: 'POST',
url: 'http://localhost:3006/ConsumerServices.svc/GetData',
data: DetailsJson,
headers:
{
'Content-Type': 'application/json; charset=utf-8',
'Content-Length': DetailsJson.length
}
}).then(function (response) {
success(response);
}, function (errorresponse) {
error(errorresponse);
});
而且,您还可以使用Google chrome的Advanced Rest Client( chrome:// apps / )进行调试
并在web.config file.as中进行一些更改
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept"/>
</customHeaders>
</httpProtocol>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.