我怎么可以嵌入在DLL中的Web服务设置? [英] How can I embed web service settings in a DLL?

查看:160
本文介绍了我怎么可以嵌入在DLL中的Web服务设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在VB.NET一个DLL将由一个ASP.NET网站引用。

I am writing a DLL in VB.NET which will be referenced by an ASP.NET website.

DLL项目有一个参考它的Web服务。当我加入web服务的项目,配置信息的块被添加到'的app.config'文件

The DLL project has a reference to a web service in it. When I added the web service to the project, a chunk of configuration information was added to the 'app.config' file.

为了得到这个主机的网站工作,我不得不将信息复制在的app.config文件到网站的web.config文件。

In order to get this to work in the host website, I had to copy the information in the 'app.config' file into the 'web.config' of the website.

有谁知道我可以嵌入这些设置成我的编译的DLL?我不希望我的DLL的消费者不得不插入此设置阻止到他们的web.config文件中。

Does anybody know how I can embed these settings into my compiled DLL? I don't want the consumers of my DLL to have to insert this settings block into their web.config files.

推荐答案

在'svc.Endpoint.Address预计类型System.ServiceModel.EndpointAddress的对象,因此实际上所需要的是对的行...

The 'svc.Endpoint.Address' expects an object of type System.ServiceModel.EndpointAddress, so in fact what is required is on the lines of...

Dim address As New System.ServiceModel.EndpointAddress("http://Whatever")
Dim binding As New System.ServiceModel.BasicHttpBinding()

' The binding object is already set up with the default values normally found in the
' <bindings> section of the App.Config, but can be overriden here, eg...
binding.ReceiveTimeout = new System.TimeSpan(0,20,0)

Dim ws As New MyWebServiceSoapClient(binding, address)

这篇关于我怎么可以嵌入在DLL中的Web服务设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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