无需重新部署即可以任何方式更改WebService端点安装时间 [英] Change WebService Endpoint installation time or any way without doing redeployment

查看:77
本文介绍了无需重新部署即可以任何方式更改WebService端点安装时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi

我从中获取数据Web服务到VSTO Excel工作簿
项目。





我的数据即将到来且工作正常



当我部署此应用程序时它给了我安装程序我可以安装它
并且它正在运行完成。





现在扭曲之后



< span style ="font-size:9.0pt; font-family:'Verdana','sans-serif'; color:black"> Web服务URL
已更改



所以我的应用程序无法在已安装的系统上运行,我需要将User
提供给新的安装程序





有什么办法,当我们安装应用程序时,它会要求
网络服务的URL和/或不知何故,我们可以更改应用程序URL,它将
工作





我不想要新的每次更改URL时,每次设置到每个客户端。

解决方案

Manish -

你可能最好在WCF论坛上询问,但我会给你有点可能会让你去。我喜欢做的是使用SVCUTIL.EXE程序来创建我的代理类,而不是添加直接引用。这为您提供了更容易修改的代码。

然后,您需要为您的服务创建一个新的绑定:


BasicHttpBinding myBinding = new BasicHttpBinding ();

如果需要,可以在其上设置安全模式:

myBinding .Security.Mode =
BasicHttpSecurityMode .TransportWithMessageCredential ;
myBinding.Security.Message.ClientCredentialType =
BasicHttpMessageCredentialType < font size = 2> .UserName;


那么当你查看你的代理类时,create方法应该同时寻找一个绑定和URL,因此创建看起来像:

myProxy =
new WebSeriviceProxy (myBinding, new EndpointAddress (服务器网址)) ;

创建后,可以根据需要添加安全性:

myProxy.ChannelFactory.Credentials.UserName.UserName = UserName ;
myProxy.ChannelFactory.Credentials.UserName.Password = 密码;

如果您不需要安全性,只需更改上面的安全模式。


至于提示输入网址,最好添加某种设置屏幕,以便在应用程序中进行更改。然后只使用上面代码中保存的内容。

希望能让你前进。

- Dan


结果,搜索结果,搜索结果

结果

Hi

I am fetching data from the web service to VSTO Excel workbook project.

 

My data is coming and working fine 

When I deploy this app it is giving me installer I can install it and it is running complete.

 

Now twist come after that

Web service URL  is changed 

So my app will not work on installed system and I need to give User to new installer 

 

Is there any way that when we install application it will ask for URL of web service and or somehow we can change application URL and it will work

 

I don’t want to new setup to each client every time on each URL change. 

解决方案

Manish -

You'd probably be better off asking in the WCF forum, but I'll give you a bit that might get you going.  What I like to do is use the SVCUTIL.EXE program to create my proxy classes instead of adding the direct reference.  This gives you code that's a bit easier to modify.

Then, you need to create a new binding for your service:

BasicHttpBinding myBinding = new BasicHttpBinding();

and you can set the security mode on it if you need to:

myBinding.Security.Mode =
BasicHttpSecurityMode.TransportWithMessageCredential;
myBinding.Security.Message.ClientCredentialType =
BasicHttpMessageCredentialType.UserName;


Then when you look at your proxy class, the create method should be looking for both a binding and a URL, so the creation would look something like:

myProxy =
new WebSeriviceProxy(myBinding, new EndpointAddress(server url));

Once you create it, you can add your security if you need it:

myProxy.ChannelFactory.Credentials.UserName.UserName = UserName;
myProxy.ChannelFactory.Credentials.UserName.Password = Password;

If you don't need security, just change the security mode above.

As for prompting for the URL, you'll probably better off adding some sort of settings screen so it can be changed from within the application.  Then just use whatever is saved in the above code.

Hopefully that gets you going.

-- Dan






 



这篇关于无需重新部署即可以任何方式更改WebService端点安装时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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