Anish
Anish

Reputation: 3172

Binding error in WCF

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)

Upvotes: 1

Views: 511

Answers (1)

Jan K&#246;hler
Jan K&#246;hler

Reputation: 6030

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>

Upvotes: 3

Related Questions