moved net.tcp WCF services from localhost to IP ad

2019-06-14 07:12发布

问题:

I have a website running 2 WCF services. Working awesome until I needed to move them from the "Default Web Site" in IIS7 to a dedicated website with a new IP address. Now I get the error message:

"...could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name"

ALL I did was change:

net.tcp://localhost/...

TO:

net.tcp://10.1.2.204/...

I have changed every spot in my configs which once used localhost to specified IP address. The new website is setup exactly the same with the proper net.tcp bindings and it is bound to the single IP address of 10.1.2.204.

I cannot seem to figure out what is going on. I am looking at the svc trace logs and all I get is a bunch of the same.

My new website is called "core" whereas previously I was hosting on "Default Web Site". I added a new FQDN/public IP to route to this new site (backwards to the mentioned private IP address). Now my services are busted.

I know baseAddress is ignored when using IIS/WAS hosting, so I am not sure what else to check. I changed absolutely nothing else in the configs.

What else can I provide to help troubleshoot this?

--

I am also seeing this in the service trace viewer:

Activity Name Receive bytes on connection 'Listen at 'net.tcp://hole.myserver.com/...'.'.

...but the WCF services are actually hosted on that new "core" website which translates to my new private IP address. I have change FQDN names for the example. To make it clear:

I used to have 1 FQDN on this server using Default Web Site.

I now added a 2nd FQDN to this server, new website, second IP. It seems to me that the listening should be directed towards: net.tcp://core.myserver.com instead of net.tcp://hole.myserver.com. Let's pretend the server name is hole.myserver.com and my new website is core.myserver.com on the same server.

Hopefully this is not confusing and you can make sense of it.

I'm using the default net.tcp port of 808 and binding of 808:*

--

This is the first exception thrown that I can tell:

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:10'.

--

None of these combos will activate the service and all produce the same exception:

net.tcp://localhost net.tcp://localhost:808 net.tcp://10.1.2.204 net.tcp://10.1.2.204:808

even using a different port which I have done before without issue:

net.tcp://localhost:75 net.tcp://10.1.2.204:75

none of these work. :(

Thanks so much!

回答1:

Its rights issue. Right click on your new website --> then Edit Permissions. On properties window click security tab and Edit button. Then Add IIS_IUSRS and give Read & Execute, List folder contents, Read permissions. Now iisreset and start to host and connect net tcp on new website.



标签: wcf was net.tcp