使用 REST 的 WCF,有一些绑定问题
我现在真的很困惑,在任何地方都找不到正确的答案。
我的困惑是:
1) SOAP 中不是使用 wsHttpBinging (增强了 basicHttpBinding)而不是 REST 而 REST 仅使用 webHttpBinding 吗?
2)另外,具有WCF(REST)的silverlight 4是否支持wsHttpBinding(VS2010)?我读到它并不是在网上随处可见,但我知道如何让 silverlight 4 使用 wsHttpBinding 与 REST 一起工作。 注意:我正在使用 Factory="System.ServiceModel.Activation.WebServiceHostFactory"。这个工厂设置是否以某种方式绕过了我的 wsHttpBinding 的 web.config 设置,使其与 webHttpBinding 一起工作,并且我认为我的 wsHttpBinding 正在工作?
谢谢。
I am really confused right now and I can't get any right answers anywhere.
My confusions are:
1) Isn't wsHttpBinging (which is beefed up basicHttpBinding) used in SOAP instead of REST and REST only uses webHttpBinding?
2) Also, DOES silverlight 4 with WCF (REST) support wsHttpBinding (VS2010)? I read that it does not everywhere on the net but I some how got silverlight 4 working with REST using wsHttpBinding.
NOTE: I am using Factory="System.ServiceModel.Activation.WebServiceHostFactory". Is this factory setting somehow bypassing my web.config setting for wsHttpBinding to make it work with webHttpBinding and i am thinking by my wsHttpBinding is working?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WCF 默认使用 SOAP - 除 webHttpBinding 之外的所有绑定都使用 SOAP。
如果你想做REST,你需要使用
webHttpBinding
。是 -
wsHttpBinding
是基于 SOAP 的协议 -webHttpBinding
是 RESTSilverlight 4 支持
basicHttpBinding
(SOAP)、netTcpBinding
(SL4 中的新增功能 - SOAP)和webHttpBinding
(REST)。是的,如果您在 SVC 文件中使用
WebServiceHostFactory
,那么您确实隐式获得了webHttpBinding
(REST)。 WCF 运行时不会查看您的 web.config 中的信息 - 它具有您使用 WebServiceHostFactory 时所需的所有信息和设置 - 并且您会获得webHttpBinding
。WCF uses SOAP by default - all binding except the webHttpBinding use SOAP.
If you want to do REST, you need to use the
webHttpBinding
.Yes -
wsHttpBinding
is a SOAP-based protocol -webHttpBinding
is RESTSilverlight 4 supports
basicHttpBinding
(SOAP),netTcpBinding
(new in SL4 - SOAP) andwebHttpBinding
(REST).Yes, if you use the
WebServiceHostFactory
in your SVC file, then you're really getting thewebHttpBinding
(REST) implicitly. The WCF runtime will not look at your web.config for infos - it has all the information and settings it needs when you use WebServiceHostFactory - and you getwebHttpBinding
.