简体   繁体   中英

WCF service endpoint configuration doesn't like the binding attribute

In my web.config file I have the following service defined:

<services>
  <service name="ShareYourWage.Service.WageService" behaviorConfiguration ="metadataBehavior">
    <endpoint>
      binding="basicHttpBinding"
      contract="ShareYourWage.Service.IWageService">
    </endpoint>
  </service>
</services>

Yet, when I debug the service, the test client throws the following error:

Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.

and digging into the specific error points to the endpoint section shows the following error:

The configuration section cannot contain a CDATA or text element.

I've Googled this error and the MSDN site and have used their examples and still have this problem. A 2nd pair of eyes would be big help, thanks!

You accidentally closed your endpoint tag before the binding and contract attributes.

Remove the '>' at the end of <endpoint> .

You want it to be like this:

<endpoint
  binding="basicHttpBinding"
  contract="ShareYourWage.Service.IWageService">
</endpoint>

If you're using Visual Studio or some other XML-aware text editor to modify the config files, the syntax highlighting can be helpful for spotting these kinds of problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM