在WCF绑定错误 [英] Binding error in WCF
本文介绍了在WCF绑定错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我跟着指示在这里: HTTP:/ /msdn.microsoft.com/en-us/library/ms731774(v=vs.110).aspx ,但我得到一个错误的结合。 配置
<绑定>
<的wsHttpBinding>
<绑定名称=wsHttpBinding_Inventory>
<安全模式=消息>
<消息clientCredentialType =用户名/>
< /安全>
< /装订>
< /的wsHttpBinding>
< /绑定>
<服务>
<服务名称=Viopsys.API.V_1_0.InventorybehaviorConfiguration =MyServiceBehavior>
<主机>
< baseAddresses>
<新增baseAddress =HTTP://本地主机:8732 / Viopsys.API / V_1_0 /库存/>
< / baseAddresses>
< /主机>
<端点地址=PurchaseOrder的绑定=wsHttpBinding_Inventory合同=Viopsys.API.V_1_0.IPurchaseOrder>
<身份>
< DNS值=本地主机/>
< /身分>
< /端点>
< /服务>
< /服务>
错误
System.Configuration.ConfigurationErrorsException:配置绑定扩展system.serviceModel /绑定/ wsHttpBinding_Inventory'找不到。验证此绑定扩展在system.serviceModel /扩展/ bindingExtensions正确注册,而且拼写正确。
在System.Configuration.BaseConfigurationRecord.EvaluateOne(字符串[]键,SectionInput的输入,布尔isTrusted,FactoryRecord factoryRecord,SectionRecord sectionRecord,对象parentResult)
在System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord,SectionRecord sectionRecord,对象parentResult,布尔getLkg,布尔getRuntimeObject,对象和放大器;结果,对象和放大器; resultRuntimeObject)
在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串configKey,布尔getLkg,布尔的checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和放大器;结果,对象和放大器; resultRuntimeObject)
在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串configKey,布尔getLkg,布尔的checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和放大器;结果,对象和放大器; resultRuntimeObject)
在System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串configKey,布尔getLkg,布尔的checkPermission,布尔getRuntimeObject,布尔requestIsHere,对象和放大器;结果,对象和放大器; resultRuntimeObject)
在System.Configuration.BaseConfigurationRecord.GetSection(字符串configKey)
在System.Configuration.ConfigurationManager.GetSection(字符串sectionName)
在System.ServiceModel.Activation.AspNetEnvironment.UnsafeGetSectionFromConfigurationManager(字符串sectionPath)
在System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext,串sectionPath)
在System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader,ServiceDescription描述,字符串configurationName)
在System.ServiceModel.ServiceHost.ApplyConfiguration()
在System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
在System.ServiceModel.ServiceHost..ctor(类型的serviceType,乌里[] baseAddresses)
在Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(类型类型,ServiceKind的那种)
在Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo信息)
解决方案
我会说有链接的MSDN文章中的错误。 他们把bindingConfiguration到绑定属性。正确的端点配置将如下所示:
<端点地址=PurchaseOrder的
绑定=的wsHttpBinding
bindingConfiguration =wsHttpBinding_Inventory
合同=Viopsys.API.V_1_0.IPurchaseOrder>
<身份>
< DNS值=本地主机/>
< /身分>
< /端点>
甚至有MSDN文章在另外一个故障(你做的已经右图): 他们定义绑定为
<绑定>
< WsHttpBinding的>
...
< / WsHttpBinding的>
< /绑定>
,但它必须是
<绑定>
<的wsHttpBinding>
...
< /的wsHttpBinding>
< /绑定>
I followed the instructions here: http://msdn.microsoft.com/en-us/library/ms731774(v=vs.110).aspx, but I am getting an error with the binding. Config
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding_Inventory">
<security mode="Message">
<message clientCredentialType="UserName"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="Viopsys.API.V_1_0.Inventory" behaviorConfiguration="MyServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Viopsys.API/V_1_0/Inventory" />
</baseAddresses>
</host>
<endpoint address="PurchaseOrder" binding="wsHttpBinding_Inventory" contract="Viopsys.API.V_1_0.IPurchaseOrder">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
Error
System.Configuration.ConfigurationErrorsException: Configuration binding extension 'system.serviceModel/bindings/wsHttpBinding_Inventory' could not be found. Verify that this binding extension is properly registered in system.serviceModel/extensions/bindingExtensions and that it is spelled correctly.
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.ServiceModel.Activation.AspNetEnvironment.UnsafeGetSectionFromConfigurationManager(String sectionPath)
at System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(ContextInformation evalContext, String sectionPath)
at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName)
at System.ServiceModel.ServiceHost.ApplyConfiguration()
at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(Type type, ServiceKind kind)
at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)
解决方案
I'd say there's an error in the linked MSDN article. They put the bindingConfiguration into the binding attribute. The correct endpoint configuration would look as follows:
<endpoint address="PurchaseOrder"
binding="wsHttpBinding"
bindingConfiguration="wsHttpBinding_Inventory"
contract="Viopsys.API.V_1_0.IPurchaseOrder">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
There is even another fault in the MSDN article (you did it already right): They defined the binding as
<bindings>
<WSHttpBinding>
...
</WSHttpBinding>
</bindings>
but it has to be
<bindings>
<wsHttpBinding>
...
</wsHttpBinding>
</bindings>
这篇关于在WCF绑定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文