简体   繁体   English

Web服务配置存储

[英]Web service configuration storage

I have created simple web service MySrv using C# . 我已经使用C#创建了简单的Web服务MySrv Now I need to have some specific configuration data like paths, debug level for logging and others. 现在,我需要一些特定的配置数据,例如路径,日志记录的调试级别等。 For this reason I was thinking to have static class object called Config and load it's data to from ini file or database table. 因此,我正在考虑使用名为Config静态类对象,并将其数据从ini文件或数据库表中加载。 But when I looked to projects Class View I found interesting section called MySrv.Properties Probably this is place where I can store my configuration? 但是当我查看项目“ Class View ,发现了一个有趣的部分,称为MySrv.Properties可能是我可以存储配置的地方? Another interesting place for storing configuration is Web.config . 存储配置的另一个有趣的地方是Web.config Is it good manner to use this file for custom settings. 使用此文件进行自定义设置的好方法。

Which way is the nicest to store specific configuration data? 哪种方法最适合存储特定的配置数据?

From my knowledge web.config will be the best option. 据我所知,web.config将是最佳选择。 You can add your config section in config file and this can be loaded to your custom class very easily. 您可以在配置文件中添加配置部分,并且可以很容易地将其加载到自定义类中。 As it is XML, modifying settings will be simplified. 由于是XML,因此可以简化修改设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM