I'm having trouble getting a .Net CWS client to connect using HTTPS on IIS. This same code works fine for a server that is running on Tomcat, which makes me suspect the IIS configuration, however I can connect to the IIS server using HTTPS and the OTCS UI, so the IIS configuration can't be too far wrong. It works fine with HTTP rather than HTTPS on both servers. The error returned is 404, however when I try to connect using a browser, it finds the service and gives me an approriate message. Anyone have any ideas?
Some code snippets. For HTTPS, the only differece is the binding class used. It doesn't make any difference if I specify the port (443) on the URL when I create the EndPointAddress.
//
// Create the Authentication service client
//
authClient = new AuthenticationClient( binding, address );
//
// Call the AuthenticateUser() method to get an authentication token
//
AuthToken = authClient.AuthenticateUser( username, password ); <== Error occurs here
/// <summary>
/// Create binding based on whether HTTPS is needed.
/// </summary>
/// <param name="bHttps"></param>
/// <returns></returns>
public static HttpBindingBase NewBinding( bool bHttps )
{
HttpBindingBase binding = null;
const int MaxMessageSize = 0x200000; // A little over 2MB. Default is 65536
if (bHttps) {
binding = new BasicHttpsBinding();
} else {
binding = new BasicHttpBinding();
}
binding.MaxBufferSize = MaxMessageSize;
binding.MaxReceivedMessageSize = MaxMessageSize;
binding.ReaderQuotas.MaxArrayLength = MaxMessageSize;
binding.ReaderQuotas.MaxStringContentLength = MaxMessageSize;
binding.ReaderQuotas.MaxDepth = 64;
return binding;
}
Inner Exception _message "The remote server returned an error: (404) Not Found." string
\r\nServer stack trace: \r\n
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)\r\n
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)\r\n
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)\r\n
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)\r\n
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n