如何在asp.net mvc Web服务中配置服务引用 [英] how to make service reference configurable in asp.net mvc web service

查看:56
本文介绍了如何在asp.net mvc Web服务中配置服务引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在sso app中创建了一个web服务

和iam在sso库中访问该web服务

i想要制作这个web服务url是可配置的,这样我就可以在任何系统中运行而不管localhost端口号如何实现这个目的。

如何让我的web refernece URL动态配置

解决方案

使用Web.Config。



http://support.microsoft.com/kb/815179 [ ^ ]


右键单击并在项目中添加服务引用时,web.config或app.config(取决于项目类型)将具有以下项目:可用于更改配置。

 <  端点    address   =  http://yourouwn.service.url.com /service.asmx\">  
binding =basicHttpBindingbindingConfiguration =ServiceSoap
contract =SomeNameHere.ServiceSoap name =ServiceSoap/> < / endpoint >


Hi,
I have created a web service in sso app
and iam accessing that web service in sso library
i want to make this web service url configurable so that i can run in any system irrespective of localhost port number.how to achieve this.
how do i make my web refernece URL Configurable dynamically

解决方案

Use Web.Config.

http://support.microsoft.com/kb/815179[^]


When you right click and add service reference in your project, the web.config or the app.config (depending on the project type) will have the below item which can be used for changing configurations.

<endpoint address="http://yourouwn.service.url.com/service.asmx">
                binding="basicHttpBinding" bindingConfiguration="ServiceSoap"
                contract="SomeNameHere.ServiceSoap" name="ServiceSoap" /></endpoint>


这篇关于如何在asp.net mvc Web服务中配置服务引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆