简体   繁体   English

从另一个WCF服务调用ASMX或WCF服务

[英]Call ASMX or WCF service from another WCF service

I have a windows service (WCF service with Windows authentication and netTCPBinding) which is consumed by WPF application. 我有一个Windows服务(Windows身份验证和netTCPBinding的WCF服务),WPF应用程序使用它。 Now, I have a requirement to call another service hosted on separate machine (it can be ASMX or WCF service) from my windows service. 现在,我需要从我的Windows服务调用托管在单独机器上的另一个服务(它可以是ASMX或WCF服务)。

I would like to know 我想知道

a) Is it the correct practice to call one web service from another or should i call it from my WPF application a)从另一个Web服务调用一个Web服务是正确的做法,还是应该从我的WPF应用程序调用它

b) If i have to call this service from my windows service what all things I need to consider and any pitfalls I should be aware of like authentication, bindings. b)如果我必须从我的Windows服务中调用此服务,我需要考虑的所有事情以及我应该注意的任何陷阱,如身份验证,绑定。

Any links showing similar implementations will be helpful 任何显示类似实现的链接都会有所帮助

Thanks 谢谢

a) There is no reason you shouldn't but be sure you wrap any errors that can happen in your other service, dot let errors from your downstream service bubble up to your calling (WPF) application. a)没有理由你不应该确定你包装在你的其他服务中可能发生的任何错误,让你的下游服务错误点到你的调用(WPF)应用程序。

b) Nothing you wouldn't have encountered in your Calling application, like timeout issues. b)在您的Calling应用程序中没有遇到任何问题,例如超时问题。 Make sure your Client to service timeout caters for the timeouts of the service to downstream service. 确保您的客户端服务超时满足服务到下游服务的超时。

Also, can I suggest from experience, try and stick to the ChannelFactory pattern http://msdn.microsoft.com/en-us/library/ms734681(v=vs.110).aspx . 另外,我可以根据经验建议,尝试并坚持使用ChannelFactory模式http://msdn.microsoft.com/en-us/library/ms734681(v=vs.110).aspx

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

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