在app.config中使用ConnectionString部署Web服务时出现问题

问题描述:

我正在开发要在Windows中托管的Web服务. (这是我的第一个,因此,如果我使用了错误的术语,请原谅我).在手动开发和测试它时,我没有从app.config中访问ConnectionString的问题.但是,那 当我将其编译为dll并尝试从另一个应用程序将其作为引用进行调用时,它拒绝从配置文件中读取连接字符串. 

I am developing a web service to be hosted in Windows. (This is my first one, so please forgive me if I use the wrong terminology). While developing and testing it manually I have no problems accessing the ConnectionString from the app.config. However, the moment I compile it into a dll and try to call it as a reference from another application, it refuses to read the connection string from the config file. 

在研究中,我发现一些快速提及Windows Web服务无法从配置文件读取的内容?如果是这样,如何存储我的连接字符串?我不想出于各种原因将其硬编码到应用中,最重要的是安全性, 这是我的应用程序的重中之重.完成后,我打算对配置文件中的连接字符串进行加密.

In researching I have found a few quick mentions that a Windows web service cannot read from a config file? If that is true, how do I store my connection string? I do not want to hard code it into the app for various reasons, the most important being security, which is a top priority for my application. After I got it working I was planning on encrypting the connection string within the config file.

有人可以告诉我最好的方法吗?  (仅供参考-我正在使用VB.NET在VS 2015中工作)

Can anyone tell me the best way to do this?  (FYI - I am working in VS 2015, using VB.NET)

你好,

通过将其添加到另一个项目中作为参考进行调用,会将DLL复制到另一个项目,但不会将Bin \ Debug或Bin \ Release下的app.config文件复制到另一个项目.还有其他想法需要研究,但是请首先尝试.

Calling it as a reference by adding it to another project copies the DLL to the other project but not the app.config file under Bin\Debug or Bin\Release, copy t to the other project. There are other ideas to work on but try this first.