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;
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>