<endpoint address="..." />
웹 서비스의 값을 프로그래밍 방식으로 변경할 수 있습니까?프로그래밍 방식으로 웹 서비스의 끝점을 편집하십시오.
<system.serviceModel>
<bindings>
...
</bindings>
<client>
<endpoint address="http://dev.remotedomain.com/WebServices/WebService.asmx"
binding="basicHttpBinding" bindingConfiguration="InboxServiceSoap"
contract="InboxServiceSoap"
name="InboxServiceSoap" />
</client>
</system.serviceModel>
내가 변경할 수 있도록하려면
address="http://dev.remotedomain.com/WebServices/WebService.asmx"
코드
address="http://mymachine/WebServices/WebService.asmx"
에 내 app.config 파일에서, 나는 다음과 같은 코드가 있습니다. .NET에서 프로 그램 가능한가요?
는
이를 작동하지만 의심 스럽습니다. WCF Service Reference를 추가 한 후 서비스 URL을 참조하는 프로젝트 파일이 여섯 개 있습니다. 그런 다음 서비스를 다른 URL로 이동하고이 코드 줄을 추가하면 모든 것이 올바르게 작동합니다. 그것은 컴파일해서는 안된다 ??? – nuander
C# : service.Endpoint.Address = new EndpointAddress (myUrl); –
@nuander 컴파일은 괜찮습니다. 단지 문자열 만 다릅니다. 다른 URL이 동일한 프로토콜 및 형식을 준수하면 런타임 문제가 발생하지 않습니다. –