自定义绑定元素无法在 IIS 下的 WCF 中加载,但可以在 WCF 自托管下加载
我能够运行 MSFT WCF 示例下载附带的 WCF-SecureProfile 示例 (http://msdn.microsoft.com/en-us/library/ee818238.aspx)
但是我无法将此服务器组件移植到 IIS。我得到的错误是 无法加载
。考虑到我已加载行为扩展,我不知道为什么 IIS 无法看到该扩展,但我的应用程序的自托管版本可以。
我将项目的源代码上传到 codeplex 以便于浏览。这是指向 web.config 和所有其他文件的直接链接。
I'm able to run the WCF-SecureProfile sample that comes with the MSFT WCF samples download (http://msdn.microsoft.com/en-us/library/ee818238.aspx)
However I can't port this server component to IIS. I get the error that<MakeConnectionBindingElement/>
can't be loaded. Considering that I have the behavior extensions loaded I don't know why IIS can't see the extension, however the self-host version of my app can.
I uploaded the sourcecode of the project into codeplex for easy browsing. Here is a direct link to web.config and all other files.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我获取了示例并将其设置为在本地 IIS 上运行。我没有遇到与这个问题相同的问题,但我确实遇到了一个大问题。访问 IIS 中的服务时出现以下错误消息:
经过一番绞尽脑汁,我找到了这个问题的原因。 WCF 4 现在为每个传输分配默认绑定(我越来越喜欢这个功能)。对于 HTTP 传输,默认绑定是 basicHttpBinding。问题是 customBinding 配置不会覆盖任何默认绑定。这会导致 WCF 尝试通过 basicHttpBinding 配置双工,这当然不受支持。修复方法是关闭 HTTP 的默认传输映射,并将其分配给您的自定义绑定,如下所示:
将其添加到 serviceModel 元素后,基于 IIS 的服务工作得很好。
I got the sample and set it up to run on IIS local. I didn't get the same issue as the one in this question but I did run into a big gotcha. Accessing the service in IIS gave me this error message:
After some head scratching, I found the cause of this issue. WCF 4 now assigns default bindings to each transport (I'm liking this feature less & less). For the HTTP transport, the default binding is basicHttpBinding. The problem is the customBinding config does not override any default binding. This causes WCF to attempt to configure duplex over basicHttpBinding which of course isn't supported. The fix is to turn off the default transport mapping for HTTP and assign it to your custom binding as shown below for this service:
Once I added this to the serviceModel element, the IIS based service worked just fine.