从DLL更新Web服务而无需重新编译. [英] Updating web service from dll without recompiling.

查看:76
本文介绍了从DLL更新Web服务而无需重新编译.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我有一个Windows应用程序可以捕获图像.
应用程序将此图像路径传递给dll,并且该dll将图像转换为字节并将其传递给Web服务.
我之所以使用Web服务,是因为我有一个软件可以将图像提取到一些我需要许可的模板中,而不是在每台本地计算机中提取它,而是使用Web服务. 现在我的问题是每次我更新Web服务时都需要从dll更新Web引用,然后需要构建该dll并再次添加到Windows应用程序.
有什么办法可以直接更新dll..
我试图更改dll的配置文件,但它不影响项目..
给出一些建议..

我的配置文件中有这个文件:

hi all
I have one windows application which capture images.
application pass this image path to dll and that dll convert that image into byte and pass it to web service.
i have used web service because i have one software which extract image into some template for which i need license.so instead of extracting it in each local machine i am using web service.
Now my question is every time i update my web service i need to update web reference from dll then i need to build that dll and add to windows application again.
is there any way that i can update dll directly..
i tried to change config file of dll but it is not affecting the project..
give some suggestions..

I have this in my config file:

<userSettings>
        <Cns_TestWebService.Properties.Settings>
            <setting name="Cns_TestWebService_localhost_Service1" serializeAs="String">
                <value>http://localhost/WebService1/Service1.asmx</value>
            </setting>
        </Cns_TestWebService.Properties.Settings>
    </userSettings>



现在,当我更改配置文件时,它应该会影响Web服务的网址.

谢谢你.
上帝保佑大家.. :):)



now when i''ll change my config file it should affect the web service url.

thank u..
god bless u all..:) :)

推荐答案

远程/动态调用Web服务以获取更多详细信息,请检查以下链接,这可能会解决您的问题.

动态调用WebService并读取WebService定义 [ ^ ]
how-to-dynamically -invoke-web-services-in-net [ ^ ]
动态调用Web服务 [ ^ ]
Make call to web service remotely/dynamically for more details check following links, this may solve your problem.

Call WebService Dynamically and Read WebService Definition[^]
how-to-dynamically-invoke-web-services-in-net[^]
Call Web Service Dynamically[^]


首先,我在Windows应用程序的配置文件中添加了appsetting部分,并将键值设置为url:

First i have added appsetting part in config file of my windows application and set key value as url:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="MyWebServiceURL" value="http://localhost/WebService2/Service1.asmx"/>
  </appSettings>
</configuration>



然后将网络服务包含在我的dll中,并将其行为更改为动态
并在构造函数中对其service.cs进行了更改,如下所示.
从app.config设置this.url.



then included web service in my dll and change its behavior to dynamic
and made changes in its service.cs in constructor as given below.
Setting this.url from app.config.

public Service1() {
           this.Url = System.Configuration.ConfigurationManager.AppSettings["MyWebServiceURL"];
}



然后以Windows形式添加dll.
现在this.Url从Windows应用程序应用程序config中获取URL.
这样我就可以直接更改url并运行应用程序.
谢谢



then added dll in windows form.
Now this.Url picks up the url from windows application app config.
so i can directly change the url and run the application.
Thanx


这篇关于从DLL更新Web服务而无需重新编译.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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