클라이언트가 .net asmx webservice에 위치 정보를 제공했습니다. 내 웹 응용 프로그램에서 웹 서비스와 통신하기 위해 사용하는 라이브러리를 만들었습니다. 내 라이브러리에서SoapHttpClientProtocol을 사용하여 원격 서버에 연결할 수 없습니다.
, 나는이 자신의 서비스
using (vendorproxy.vendorproxy wsProxy = new vendorproxy.vendorproxy())
{
wsProxy.Credentials = new System.Net.NetworkCredential(uname, pwd);
using (Stream xmlStream = xmlUtil.GenerateStreamFromString(
wsProxy.GetData(index)))
{
//
}
}
public Stream GenerateStreamFromString(String inputString)
{
byte[] bytes = UTF8Encoding.UTF8.GetBytes(inputString);
MemoryStream strm = new MemoryStream();
strm.Write(bytes, 0, bytes.Length);
return strm;
}
클라이언트가 서비스를 테스트하기 위해 테스트 응용 프로그램을 개발하고 작동을 호출하는 내 코드입니다 ASMX
에 웹 참조를 만들었습니다. 그러나 시스템에 배포 할 때 내 애플리케이션이 실패합니다. 클라이언트가 네트워크 외부의 서비스를 노출하지 않았으므로 코드를 단계별로 실행할 수 없습니다. 이것은 xml 파일과 wsdl을 통해서만 샘플 출력을 제공함으로써 개발되었습니다.
예외 세부 정보 :
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(
String methodName, Object[] parameters)
서비스에 웹 심판이 내 클래스 라이브러리의 App.config 및 호출을 수행 한. 클래스 라이브러리가 해결 내 웹 응용 프로그램
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="clientService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
<applicationSettings>
<clientService.Properties.Settings>
<setting name="clientService_client_client" serializeAs="String">
<value>http://localhost:2362/client.asmx</value>
</setting>
</clientService.Properties.Settings>
</applicationSettings>
</configuration>
에 의해 사용됩니다 내가
using (vendorproxy.vendorproxy wsProxy = new vendorproxy.vendorproxy())
{
wsProxy.Credentials = new System.Net.NetworkCredential(uname, pwd);
wsProxy.URL = [correct asmx location read from config file]
//not sure why it would not automatically pick up from config file.
}
호출 응용 프로그램이 배포 된 서버에서 서비스가있는 주소를 핑 (ping) 할 수 있습니까? – FarligOpptreden
전체 예외 메시지가 좋을 것입니다. 부분 스택 추적 만 제공했습니다. –
서비스는 http : //machinename/somewhere/clientservice/somemthing.asmx에 있으며, 이름이 변경되었거나 위에 일치하지 않을 수 있습니다. 핑 machinename 작동합니다. 문제 없음 – user644702