기본적으로 호스트 된 서비스를 사용하여 서버와 데이터를 송수신하는 파일 서버/클라이언트 도구를 작성하는 중입니다. 이 솔루션은 많은 사람들이 사용할 것이므로, 설치를 위해 App.Config 파일을 편집하고 편집하는 것은 바람직하지 않습니다. 내가 뭘하고 싶은지는 런타임에이를 변경하여 사용자가 사용할 설정을 완벽하게 제어 할 수있게하는 것입니다.런타임시 ServiceHost EndPoint 주소 변경 C#
<system.serviceModel>
<services>
<service name="FI.ProBooks.FileSystem.FileRepositoryService">
<endpoint name="" binding="netTcpBinding"
address="net.tcp://localhost:5000"
contract="FI.ProBooks.FileSystem.IFileRepositoryService"
bindingConfiguration="customTcpBinding" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="customTcpBinding" transferMode="Streamed" maxReceivedMessageSize="20480000" />
</netTcpBinding>
</bindings>
</system.serviceModel>
내가 뭘하고 싶은 것은 주소 만 변경하는 것입니다 (이 예에서는, net.tcp : // localhost를 : 5000) 응용 프로그램이 실행 그래서,이 내 app.config 파일입니다. 따라서 현재 값을 읽고이를 사용자에게 표시 한 다음 입력을 가져 와서 해당 필드에 다시 저장할 수 있어야합니다.
문제는 ServiceHost를하지 클라이언트에 관한 한 –