简体   繁体   English

我可以通过WCF使用REST和SOAP公开服务吗?

[英]Can I expose a service with REST & SOAP via WCF?

I want to architecture our software so that we can expose our API logic using WCF (SOAP and REST). 我想构建我们的软件,以便我们可以使用WCF(SOAP和REST)公开我们的API逻辑。

Im confused as to whether I have to use ASMX files if I want to do SOAP services, or whether .svc file can still do SOAP service? 我很困惑,如果我想做SOAP服务,是否必须使用ASMX文件,或者.svc文件是否仍然可以使用SOAP服务?

Yes you can. 是的你可以。 You have to expose a SOAP end-point for your WCF service. 您必须为WCF服务公开SOAP端点。 This MSDN post has an example. 这篇MSDN帖子有一个例子。

Your svc file can provide the restful interface you are requesting. 您的svc文件可以提供您请求的restful接口。 You just have to do a little configuring within your web configuration file, and decorate the svc class with the attributes to describe the behavior of our restful url. 您只需在Web配置文件中进行一些配置,并使用属性来装饰svc类以描述我们的restful url的行为。

here is a great article going over the steps: 这是一篇很棒的文章:

http://www.dotnetfunda.com/articles/show/779/simple-5-steps-to-expose-wcf-services-using-rest-style http://www.dotnetfunda.com/articles/show/779/simple-5-steps-to-expose-wcf-services-using-rest-style

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

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