[英]Are the WCF Endpoints kept in the app.config or the web.config?
When I create a WCF Service Library, an app.config is generated for me where I put the end points. 当我创建WCF服务库时,会为我生成一个app.config,用于放置端点。 Then if I create a website and reference the WCF Service Library, it creates a web.config file where I can specify the end points.
然后,如果我创建一个网站并引用WCF服务库,它会创建一个web.config文件,我可以在其中指定端点。 Do I put the end points in the app.config or web.config or do they have to be in both?
我是否将端点放在app.config或web.config中,或者它们是否必须同时存在?
Essentially, it's Web.config
if you're hosting the services in IIS, app.config
if you're self hosting. 基本上,它是
Web.config
如果您在IIS中托管服务, app.config
如果您是自托管。 So it sounds like you want to put them in the web.config
. 所以听起来你想把它们放在
web.config
。
Full details can be found here where MSDN says: 完整的详细信息可以在这里找到MSDN说:
When configuring a service in Visual Studio, use either a Web.config file or an App.config file to specify the settings.
在Visual Studio中配置服务时,请使用Web.config文件或App.config文件来指定设置。 The choice of the configuration file name is determined by the hosting environment you choose for the service.
配置文件名的选择取决于您为服务选择的托管环境。 If you are using IIS to host your service, use a Web.config file.
如果您使用IIS来托管服务,请使用Web.config文件。 If you are using any other hosting environment, use an App.config file.
如果您使用的是任何其他托管环境,请使用App.config文件。
In Visual Studio, the file named App.config is used to create the final configuration file.
在Visual Studio中,名为App.config的文件用于创建最终配置文件。 The final name actually used for the configuration depends on the assembly name.
实际用于配置的最终名称取决于程序集名称。 For example, an assembly named "Cohowinery.exe" has a final configuration file name of "Cohowinery.exe.config".
例如,名为“Cohowinery.exe”的程序集的最终配置文件名为“Cohowinery.exe.config”。 However, you only need to modify the App.config file.
但是,您只需要修改App.config文件。 Changes made to that file are automatically made to the final application configuration file at compile time.
在编译时,对该文件所做的更改将自动发送到最终的应用程序配置文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.