SoapException Server was unable to process request on ASMX webservice in MVC site

41,409

Solution 1

Issue Resolved

The exception was coming out of the Web Service itself. There were some global variables not being initialized directly through the .asmx call that were being initialized by the application itself.

Some simple checks on variables within the Web Service and setting what needs to be set have fixed up the issue.

Solution 2

If using basic auth, this has solved my issues in the past:

NetworkCredential nc = new NetworkCredential();
nc.Domain = "domain"
nc.UserName = "user"
nc.Password = "pwd"

Uri uri = new Uri(svc.Url);
ICredentials credentials = nc.GetCredential(uri, "Basic");
svc.Credentials = credentials;
Share:
41,409
RSolberg
Author by

RSolberg

@russsolberg http://rsolberg.com

Updated on July 09, 2022

Comments

  • RSolberg
    RSolberg almost 2 years

    I'm getting an exception when trying to access an .asmx webservice within a MVC site. I've tried numerous things like updating the web reference within the console application and building another quick app to test, but can't get passed this issue. If I pull the URL out of the svc variable, I can browse to it directly.

    Exception Details

    System.Web.Services.Protocols.SoapException occurred Message=Server was unable to process request. ---> Value cannot be null. Parameter name: uriString
    Source=System.Web.Services Actor="" Lang="" Node="" Role=""
    StackTrace: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at ClarityIntegration.SendTrackerDataToClarity() in [REDACTED].Reference.cs:line 78 at [REDACTED].Program.Main(String[] args) in [REDACTED].Program.cs:line 33
    InnerException:

    CONSOLE APP CODE

    var svc = new TrackerClarityService.ClarityIntegration()
        {
            Url = url,
            Credentials =
                new System.Net.NetworkCredential("user", "pass", "domain")
        };
    svc.SendTrackerDataToClarity();
    svc.Dispose(); 
    

    Issue Resolved

    The exception was coming out of the Web Service itself. There were some global variables not being initialized directly through the .asmx call that were being initialized by the application itself.

    Some simple checks on variables within the Web Service and setting what needs to be set have fixed up the issue.

    • Darin Dimitrov
      Darin Dimitrov about 13 years
      Does this work in the console application? If not, the problem is definitely not related to asp.net or asp.net-mvc and those tags doesn't seem relevant to your question.
    • RSolberg
      RSolberg about 13 years
      Darrin - It's all a single solution at this point, so I'm testing the Web Service within my console application and this is where the issue is right now. I have no clue if it's a web service issue or not right now.
    • RSolberg
      RSolberg about 13 years
      The error is actually related to the Web Service, not the console application. The asp.net-mvc and asp.net tags are very relevant to this issue.
    • Darin Dimitrov
      Darin Dimitrov about 13 years
      @RSolberg, so you are able to successfully invoke your web service from the console application. Also if the error is related to the web service the two tags are not relevant. The web-services tag is relevant though.
    • RSolberg
      RSolberg about 13 years
      @Darin: no, hence showing the exception from the console app trying to invoke the webservice.
  • Andrea
    Andrea almost 11 years
    I get this issue but i don't understand "Some simple checks on variables within the Web Service and setting what needs to be set have fixed up the issue". Could you provide an example?
  • Matt
    Matt almost 7 years
    What do you mean "Captain"?