I personally came across this issue WCF was taking machine name not IP address or domain name and also I got questions from forums about “how to replaced Machine Name with Domain name in WCF Service wsdl link?”. This occurs when we host WCF service on IIS then the links to wsdl is uses local machine name not the domain name or IP address.
You can see in browser [here I used IP address of my machine] in wsdl link its adding my computer name, this is same issue when I publish this service on production; the wsdl link is taking name of production machine not domain.
I found some solutions which changes the bindings on server but again that is not helpful for me on production server however it works well on local machine.
Then I was checking the configurations and found solution for how Domain name replaced with Machine Name in WCF Service without playing with IIS bindings. In service behavior we can change the behavior of serviceMetadata which will FIX our problem. We need to specify on what location metadata will resides httpGetUrl or httpsGetUrl. We can add url having domain rather machine name. So final configuration should look like following which is our solution.
<system.serviceModel>
<services>
<service name="Demo.Service.MultiEndPointsService" behaviorConfiguration="serviceBehaviour">
<endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="basicBinding" contract="Demo.Service.MultiEndPointsService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehaviour">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://192.168.3.61/Demo.Service/MultiEndPointsService.svc/basic" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="None"></security>
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
You can see value of httpGetUrl; I have specified IP address
Now let’s see again in browser.
There you goo!!!
26 comments:
If I have already the execute the original WCF service with domain name. After that I have tried the code given but there is an error of
A registration already exists for URI -----
I can confirm that error message. For now, I inserted a line into the Windows hosts-file mapping the computername to the ip-address of the domain. For example if domain.com is replaced by somecomputer.somenetwork.local the entry is:
XX.XXX.XXX.XXX somecomputer.somenetwork.local
Hi,
But when I click on "http://192.168.3.61/Demo.Service/MultiEndPointsService.svc/basic?WSDL" it shows "The webpage cannot be found" i.e. HTTP400 Bad request.
Please let me know your feedback on this.
Regards,
Jitendra
awesome this is a great solution thanks
Thanks for sharing this nice information. I appreciate your post. Please keep sharing more and more information. You really doing great job.
Thank you, thank you, thank you for sharing this.
It worked!
Thank you, thank you, thank you for sharing this.
It worked!
Enabling the httpsGetEnabled attribute will fix this issue.
Haridharan. R
A registration already exists for URI Solution
its working for me.. Thanks!
Thanks! Its working for me
Hello,
If you have time it would be wonderful if you could take a look on this:
http://stackoverflow.com/questions!!
/14527963/there-was-no-channel-actively-listening-at-error-to-method-of-wcf-service
Have a great day!
/Anders
Thank you very much, I searched some days to solve the problem. Now I found your website and solve it in 5 minutes perfectly.
Thank you very much once again.
YOU ROCK MAN
:)
Thanks for sharing this
Hi,
But when I click on "http://192.168.3.61/Demo.Service/MultiEndPointsService.svc/basic?WSDL" it shows "The webpage cannot be found" i.e. HTTP400 Bad request.
Thank you so much... you saved lot of my searching
It worked! Thank you so much! :)
It worked! Thank you so much!!!
It worked! Thanks a lot!!!
it worked perfectly!
thanks man!
But when I click on "http://192.168.3.61/Demo.Service/MultiEndPointsService.svc/basic?WSDL" it shows "The webpage cannot be found" i.e. HTTP400 Bad request.
Please let me know your feedback on this.
Thanks Imran,i almost spent 2 days on this issue. you blog solved my problem.
How can you add the 'HttpGetUrl' without adding 'basic' to the end?
This works totally fine but in WSDl soap:address location still has the old domain name .Any ideas on fixing that
Hello.
I have https enabled in my web.config and so I am used httpsGetURL:
And gotten an error:
A registration already exists for URI https://machineName.domain.com/ProjectName/MyService.svc
@Elana
URL should be unique, add /mex after .svc
Post a Comment