Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
web服务可以使用javascript,但不能使用.net;“无法连接/主动拒绝”;_.net_Web Services - Fatal编程技术网

web服务可以使用javascript,但不能使用.net;“无法连接/主动拒绝”;

web服务可以使用javascript,但不能使用.net;“无法连接/主动拒绝”;,.net,web-services,.net,Web Services,从asp.net 2.0调用web服务并出现“无法连接到远程服务器”/“由于目标计算机主动拒绝,无法建立连接”错误。它可以使用简单的html页面和javascript,但不能在.net中使用 javascript(作品): 我猜javascript版本中设置的一个值-soapaction、content type、method-在.net版本中没有设置,但我真的不知道是什么或如何设置的。也可能是.net使用的其他端口?不知道如果你发布了失败的代码,可能会有所帮助。没人能告诉我区别吗?为什么.ne

从asp.net 2.0调用web服务并出现“无法连接到远程服务器”/“由于目标计算机主动拒绝,无法建立连接”错误。它可以使用简单的html页面和javascript,但不能在.net中使用

javascript(作品):


我猜javascript版本中设置的一个值-soapaction、content type、method-在.net版本中没有设置,但我真的不知道是什么或如何设置的。也可能是.net使用的其他端口?不知道

如果你发布了失败的代码,可能会有所帮助。没人能告诉我区别吗?为什么.net会失败而不是javascript?无论我尝试什么,.net失败如果标头的主机值不包括端口号,这有关系吗?
var soapEnv = 
          "<soapenv:Envelope                                           " +
          "  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'     " +
          "  xmlns:xsd='http://www.w3.org/2001/XMLSchema'              " +
          "  xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' " +
          "  xmlns:urn='urn:TBEDispatcherAPI'>                         " +
          "  <soapenv:Header/>                                         " +
          "  <soapenv:Body>                                            " +
          "    <urn:getURL soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'> " +
          "      <orgCode xsi:type='xsd:string'>" + CODE + "</orgCode> " +
          "    </urn:getURL>                                           " +
          "  </soapenv:Body>                                           " +
          "</soapenv:Envelope>                                         ";

     xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
     xmlDoc.onreadystatechange = process ;   
     xmlDoc.open( "POST", URL, true );     
     xmlDoc.setRequestHeader("Content-Type", "text/xml; charset=\"utf-8\"");
     xmlDoc.setRequestHeader("SOAPAction", '""');
     xmlDoc.send(soapEnv);
DispatcherAPI.DispatcherAPIService dispatcher = new DispatcherAPI.DispatcherAPIService();
dispatcher.Url = URL;
string otherURL = dispatcher.getURL(CODE);