简体   繁体   中英

ContractFilter mismatch at the EndpointDispatcher

I have this error. I know where is problem but I can't solwe it. I have WCF web service that is working. I need seckond web service that is identical to first web service but it has diferent namespace. localhost/test1.svc localhost/test2.svc I don't want to add web referance so I used wsdl.exe on test1.svc?wsdl Now I want to call with that class test2.svc but I am geting this error.
ContractFilter mismatch at the EndpointDispatcher I found this

But I am not shure how to use it. Or ise there any other way to dinamicli add web service url.

When consuming the services, you define two different endpoints for your service:

eg

      <endpoint address="address1"
    binding="basicHttpBinding" bindingConfiguration="test1config" contract="service.icontract"
    name="test1endpoint" />
      <endpoint address="address2"
    binding="basicHttpBinding" bindingConfiguration="test2config" contract="service.icontract"
    name="test2endpoint" />

Then you can specify an endpoint you wish to use in your code like this:

var channelFactory = new ChannelFactory<IContract>("your-endpoint-name-here");

and use that to create your channel in the normal way.

From that you can choose which one you use at the right time by changing the endpoint name.

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