开发者

Machine config instead of app.config files for console apps

Is it possible to use connection strings 开发者_开发技巧in a Console app's app.config file in a single machine config file instead? So all console apps on the server can use the same file?


You could, but that would mean that any .NET application could gain access to your database.

I would advise against it, for several reaons:

  • A possible security hole.
  • Most developers would look for this information in app.config not machine.config.
  • You may end up sharing connection strings that only one or two applications need with all applications.
  • You can't limit what applications will be able to use the connection strings.
  • You will not be able to simply move the application to another machine, with the app.config file and have everything just work (you will also need to import the connection string information to the new machine.config).

You really should keep the configuration with the application that uses it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜