For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
73 2 5 5

connection forcibly closed by remote host when authenticating

I am attempting to authenticate with the REST API, but sending the request through a MVC Web application always provides the error message "An existing connection was forcibly closed by the remote host". It appears to be a request timeout, as the error always occurs after 1 min of attempting to connect.

This only occurs when I am attempting to connect through the MVC web application, while a .NET Console program allows a connection and returns a session token.

The block of code used is the same in both the web application and the console program, which is taken from the tutorials.

Uri dssUri = new Uri("https://hosted.datascopeapi.reuters.com/RestApi/v1/");
string dssUserName = "<username>";
string dssUserPassword = "<password>";

ExtractionsContext extractionsContext = new ExtractionsContext(dssUri, dssUserName, dssUserPassword);

string sessionToken = extractionsContext.SessionToken;
Console.WriteLine("Returned session token: " + sessionToken);
return sessionToken;

EDIT:

The problem was fixed by adding a default proxy to the Web.config file in the webapp.

  <system.net>  
	<defaultProxyenabled="true"useDefaultCredentials="true"></defaultProxy>
  </system.net>

dss-rest-apidatascope-selectdssrest-apiauthenticationconnectionmodel-view-controller
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
73 2 5 5

The problem actually turned out to be the MVC app not being able to access external URL's, which was solved by adding the following to the Web.config

  <system.net>
    <defaultProxyenabled="true"useDefaultCredentials="true"></defaultProxy>
  </system.net>
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
77.5k 242 52 72

My MVC web application (VS2013) works fine with DSS REST API. It tested it with IIS express and Azure. It can authenticate and get the sessionToken properly.

The problem could be from the network between the web server and the DSS server.

Are you using IIS express, IIS, or azure? Can you share the project files?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.