Jon*_*ono 4 wcf visual-web-developer visual-studio-2010
我正在尝试使用免费的Microsoft Visual Web Developer 2010 Express开始使用WCF中的事务.它为我提供了创建"WCF服务应用程序"的选项,但它似乎没有给我很多选项来托管它或配置不同的绑定.如果我F5项目我收到错误:
At least one operation on the 'Service' contract is configured with the TransactionFlowAttribute attribute set to Mandatory but the channel's binding 'BasicHttpBinding' is not configured with a TransactionFlowBindingElement. The TransactionFlowAttribute attribute set to Mandatory cannot be used without a TransactionFlowBindingElement.
我已经尝试在*/services/service/endpointweb.config中添加配置,但似乎只是被忽略了.我还尝试将默认启动应用程序更改为WcfSvcHost.exe,但此选项显示为灰色.我开始怀疑Express版本的一些失败,但我乐观地认为这只是我的笨蛋.有没有我需要学习的技巧,或者会在Visual Studio 2010的完整版本中出现,足以让我跨过这个障碍并进入下一个障碍?
谢谢!
如果不知道您的配置和服务合同,几乎不可能做出有针对性的答案.如果您认为忽略了配置,请确保在CLR名称空间中使用service并endpoint/@contract包含CLR名称空间.
WCF 4使用了很好的简化配置,恕我直言使真正的配置比以前更大的痛苦.您可以通过将其添加到Web配置来切换默认值:
<protocolMapping>
<remove scheme="http" />
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="transactionFlowEnabled"/>
</protocolMapping>
<bindings>
<wsHttpBinding>
<binding name="transactionFlowEnabled" transactionFlow="true" />
</wsHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
这是一种解决方法,它应该使用定义的绑定作为默认值而不是basicHttpBinding.
| 归档时间: |
|
| 查看次数: |
2073 次 |
| 最近记录: |