Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem calling webservice locally, works remotely

Posted on 2010-11-25
4
Medium Priority
?
812 Views
Last Modified: 2012-05-10
Got a slightly strange problem.  I've developed a small webservice that, in turn calls a second webservice (an API to a third party product over which I have no control!)  It all works fine from my development machine with the third-party API running on our webserver, but as soon as I deploy my webservice to the same server it breaks and throws the following error:

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send.
---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace
--- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at
System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) at
System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at
System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at
System.Threading.ExecutionContext.runTryCode(Object userData) at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) at
System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) at
System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace
--- at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) at
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at
RWIncidentProc.CustomerService.CustomerHandler.GetAllCustomers(Guid securityToken) in C:\Users\kenny.munro\Documents\Visual Studio 2010\Projects\RWIncidentReporting\RWIncidentProc\Web References\CustomerService\Reference.vb:line 171 at
RWIncidentProc.OnTimeFunctions.FindCustomer(Guid CustomerGUID) in C:\Users\kenny.munro\Documents\Visual Studio 2010\Projects\RWIncidentReporting\RWIncidentProc\OnTimeFunctions.vb:line 12 at
RWIncidentProc.IncidentProcessor.ProcessIncident(Byte[] Content) in C:\Users\kenny.munro\Documents\Visual Studio 2010\Projects\RWIncidentReporting\RWIncidentProc\IncidentProcessor.vb:line 58

Anyone got any ideas what's causing this?  Any help greatly appreciated!
0
Comment
Question by:kendolondon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
bansidhar earned 1000 total points
ID: 34215452
This is a network issue. Normally web servers and most of the servers inside a firewall are configured not to accept connection on public IP from internal network. The firewall blocks all such connection.

Here is the solution:
1. You can use the local IP of the web server once you are inside the network. If both the applications are in the same server then you can use the IP 127.0.0.1 to connect to the web service. of if it is in a different machine you can use the the local IP which you can get from the server administrator.

2. You have to run your application outside the web server network

3. Most insecure (your server admin will never allow this). ask the administrator to allow public IP access from inside the network.
0
 
LVL 11

Expert Comment

by:bansidhar
ID: 34215457
Sorry, Typo in my previous post

Here are the solutions:
not
Here is the solution:

Best is use first solution
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 34222926
use the third party service's local address to connect and not the public one.
0
 

Author Comment

by:kendolondon
ID: 34490860
Never did get to the bottom of why this was happening.  Ended up hosting on a separate machine which works fine.  Thanks for the help though!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question