Link to home
Start Free TrialLog in
Avatar of lbyrdjr
lbyrdjr

asked on

URGENT: Can't use web service from ASP.net web application after switching to SSL and Integrated Windows Authentication

I am have an ASP.net 2.0 web application that calls an ASP.net 2.0 web service on the same server in a different directory.  At first the service was open with no encryption and anonymous access was allowed.  The web service worked fine like this.

We recently installed an SSL certifice for the server and I un-checked anonymous access on the directory the web service is in and just left Integrated Windows Authentication.

The web application now reports the following error when calling the web service:

------------------------------------------------------------------------------------------------------------------------------------------------------------------
No connection could be made because the target machine actively refused it

[SocketException (0x274d): No connection could be made because the target machine actively refused it]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +1002146
   System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +33
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +431

[WebException: Unable to connect to the remote server]
   System.Net.HttpWebRequest.GetRequestStream() +1504525
   System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +103
   WS_Security.Security.Login(String Acf2Id, String Acf2Password) +63
   ASP.login_aspx.blnCheckUserLogin(String sUser, String sPass) in c:\inetpub\wwwroot\GSS\Login.aspx:52
   ASP.login_aspx.Login1_Authenticate(Object sender, AuthenticateEventArgs e) in c:\inetpub\wwwroot\GSS\Login.aspx:65
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +106
   System.Web.UI.WebControls.Login.AttemptLogin() +105
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
------------------------------------------------------------------------------------------------------------------------------------------------------------------

We have a windows application that also calls the web service.  The following sample code allowed it to work correctly:

Dim ws As New WebServiceName
ws.Credentials = new NetworkCredential("user", "pass", "domain")
ws.DoSomething()

When I used the same code in the web application, nothing changed and I got the same error.

Any help would be greatly appreciated.
Avatar of lbyrdjr
lbyrdjr

ASKER

Another thing that I didn't mention was that the windows application that uses the service does not run on the server.  And when I debug the web application on my development machine the web service works fine.  It is only when calling the web service from the web application on the server that fails.
The only thing that I can think of is that the windows program that works operates under the credentials of the logged on user but the asp.net app runs under MACHINE\ASPNET. I know you are setting the credentials for the webservice call but maybe this is not working correctly.

Can you modify your webservice to monitor the requests comming in and check the credentials to see what's getting passed in.

If all else fails you couyld use inpersonation in the web.config file.

Good luck
Avatar of lbyrdjr

ASKER

I found the solution.  It was not really a problem with ASP.net.  As explained to me, the browser settings were set for the primary DNS to point to localhost.  The domain name (DomainName.com and www.DomainName.com) had to be added to the HOSTS file.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial