我在Net Core中有一个连接服务,该服务获取文档,当从Visual Studio本地执行此过程时,它可以正常工作。但是在托管应用程序的服务器上执行相同的过程会引发以下异常...
我从SOAP UI进行了尝试,并且效果很好,
URL:http://ip/proxy_Docs/soap/services/Process/CreateDoc?wsdl
private async Task<MyConnectedService.invokeResponse> _createDocument(string strXml)
{
var endpoint = new MyConnectedService.Process_createDocument.EndpointConfiguration();
var service = new MyConnectedService.Process_createDocument(endpoint);
var response = new MyConnectedService.invokeResponse();
var parameter = new MyConnectedService.XML();
parameter.document = strXml;
service.ClientCredentials.UserName.UserName = "username";
service.ClientCredentials.UserName.Password = "paswword";
var scope = new OperationContextScope(service.InnerChannel);
var httpRequestProperty = new HttpRequestMessageProperty();
httpRequestProperty.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(service.ClientCredentials.UserName.UserName + ":" + service.ClientCredentials.UserName.Password));
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
response = await service.invokeAsync(parametroXml);
return response;
}
但是返回下一个错误:
InnerException”:{ “ Message”:“发送请求时发生错误。”, “数据”:{}, “ InnerException”:{ “ NativeErrorCode”:12002, “ ErrorCode”:-2147012894, “ Message”:“操作超时”, “数据”:{}, “ InnerException”:null, “ StackTrace”:“位于System.Threading.Tasks.RendezvousAwaitable
1.GetResult()rn at System.Net.Http.WinHttpHandler.StartRequest(WinHttpRequestState state)", "HelpLink": null, "Source": "System.Private.CoreLib", "HResult": -2147012894 }, "StackTrace": " at System.ServiceModel.Channels.ServiceModelHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)rn at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task
1上,位于System.ServiceModel.Channels.HttpChannelFactory`1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.SendRequestAsync(Message message。 ,TimeoutHelper timeoutHelper)“, “ HelpLink”:null, “源”:“ System.Private.CoreLib”, “ HResult”:-2147012894
奇怪的是它可以在本地运行,但不能在服务器上运行,这与IIS有关吗?这是Windows Server 2008 R2