Unable to create a session - connection forcibly closed by the remote host error?

cancel
Showing results for 
Search instead for 
Did you mean: 
Member II

Unable to create a session - connection forcibly closed by the remote host error?

Alfresco 4.2.0

CMIS 1.1

I'm creating a web service using Port CMIS to connect to Alfresco via browser binding.  Long story short, I am unable to even really begin because I can't successfully create a session.  It seems like it should be fairly straightforward, but here we are...

(Inner Exceptions)

HttpRequestException:  An error occurred while sending the request.

WebException:  The underlying connection was closed:  An unexpected error occurred on a send.

IOException:  Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

SocketException:  An existing connection was forcibly closed by the remote host.

I've dumbed it down a bit, but this is basically the code I I'm trying to run.  There's really not much to it:

private static void TestConnectToAlfresco()
{
// default factory implementation
SessionFactory factory = SessionFactory.NewInstance();

Dictionary<string, string> parameters = new Dictionary<string, string>();

// user credentials
parameters[SessionParameter.User] = Utils.GetAppSetting("ALFRESCO_USER");
parameters[SessionParameter.Password] = Utils.GetAppSetting("ALFRESCO_PASS");

// connection settings
parameters[SessionParameter.BrowserUrl] = Utils.GetAppSetting("WebURL");
parameters[SessionParameter.BindingType] = BindingType.Browser;

//create session
IList<IRepository> repos = factory.GetRepositories(parameters);
foreach (IRepository repo in repos)
{
System.Diagnostics.Debug.WriteLine("Repository Name: " + repo.Name + " RepositoryID: " + repo.Id);
}

ISession session = factory.GetRepositories(parameters)[0].CreateSession();

}

For a while, I thought maybe I was just using an incorrect URL (which is still possible), but I feel like I've tried every iteration of URL suggestion I've seen.  Pretty much always the same error.  I KNOW the credentials are good, because I can get into the Alfresco UI (or to the API) through a web browser using them.

URLs tried:

https://alfresco-test0.mycompany.com/share

https://alfresco-test0.mycompany.com/share/cmis/browser

https://alfresco-test0.mycompany.com/alfresco/api/-default-/public/cmis/versions/1.1/browser

I'm not specifying a port because it's currently just the default, but I did try explicitly specifying one for a while, but it seemed to have no effect.  Any thoughts?  Please ask if I've left out any information that might be helpful.  TIA.

-Tony

3 Replies
Master

Re: Unable to create a session - connection forcibly closed by the remote host error?

The URLs including /share are definitey the wrong ones. The last URL looks fine to me,

Did you monitor the network packages being exchanged (with HTTPS downgraded to HTTP to actually analyse the exchanged packages)? One thing I have seen in the past being an issue (depending on your system setup) is a URL redirection...

Member II

Re: Unable to create a session - connection forcibly closed by the remote host error?

Thanks for the response.  I don't have direct access to the server.  That was set up/monitored/accessed by IT Services.  (I'm on the Dev team.)  This is the first time anyone in our company has used (or tried to integrate) Alfresco so there is a bit of a learning curve all around.  He has been monitoring via "real time scanning the log for anything in the cmis path in a terminal in the background".  The only time I had gotten through at all, was when I just went directly to the url(s) via Chrome.  (Never through the program.)

I talked to him a bit yesterday to try and figure out if it's a problem with how Alfresco was set up, as I was running out of ideas.  Alfresco is currently set up more or less like they suggest for Production (i.e. proxy).  However, on a whim I decided to try a standard HTTP URL that I hadn't used before, since everything I've been told insists that the URL will be HTTPS, whatever it is:

http://alfresco-test0.mycompany.com:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser

...and it worked.  I don't quite understand why though, and this obviously wouldn't be sufficient for Prod.  So what does this mean?  Is this a set up issue?

Edit:  Additionally, even though I can create a session using standard HTTP like I showed above, I can't really DO anything.  If I try to interact with Alfresco, I get an IOException (The handshake failed due to an unexpected packet format).  I take this to mean that the server expects me to be using HTTPS/TLS and I'm not.  :-\

Master

Re: Unable to create a session - connection forcibly closed by the remote host error?

Does the client trust the SSL certificate of the server or its CA? It might just be that the HTTPS connection does not work because the client rejects the SSL handshake.