以编程方式编辑 Web 服务的端点

发布于 2024-09-15 02:08:42 字数 743 浏览 4 评论 0原文

有没有办法以编程方式更改 Web 服务的 值?在我的 app.config 文件中,我有以下代码:

<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"

代码。这在 .NET 中可以通过编程实现吗?

Is there a way I can programmatically change the <endpoint address="..." /> value of a web service? In my app.config file, I have the following code:

<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>

I want to be able to change

address="http://dev.remotedomain.com/WebServices/WebService.asmx"

to

address="http://mymachine/WebServices/WebService.asmx"

in code. Is this possible progammatically in .NET?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

つ低調成傷 2024-09-22 02:08:42

您可以使用类似于以下内容的代码:

Dim service as new XXXXXClient
service.Endpoint.Address = 新EndpointAddress(myUrl)

You can use code similar to the following:

Dim service as new XXXXXClient
service.Endpoint.Address = New EndpointAddress(myUrl)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文