WCF Client : An existing connection was forcibly closed by remote host [My Fix]

After I made a few changes to my WCF service, I hosted it in the staging server (in another machine, another country!).

Everything was working fine in my local machine and I didn't really check the Web.Config for service references. 

Once I tried to login to my system, (by the way, I have enabled tracing and logging on both service and client), it gave me this error in the big yellow screen of death.

An existing connection was forcibly closed by remote host

It was a real headache and I searched through internet like crazy. I came across this answer... http://stackoverflow.com/a/12105703/959245

And started looking into my web.config file.

And I saw this...(highlighted)

      <endpoint address="net.tcp://localhost:8009/LookupService" ...>
          <servicePrincipalName value="host/user-PC" />
That is from my local development machine. That <identity> is for my local machine. In IIS server, there's no account called USER-PC

What I did was to remove the highlighted part and voila! It works!!!!

Identities can go a long way.... from security to headaches!

Popular posts from this blog

Print a sales receipt using a thermal printer with C# for POS Application

Automatic redirect upon session timeout using ASP.NET MVC and Javascript

Could not create SSL/TLS secure channel - Fixed