app.config 文件是否像使用 IIS 的 WCF 服务 web.config 文件一样向 Windows 服务公开?
我是创建 Windows 服务来托管 WCF 的新手,因为我一直使用 IIS 来执行此操作。我创建了一个 Windows 服务来托管大约十几个 WCF 服务,并在 Visual Studio 中设置了一个 app.config 文件来处理每个服务的所有端点和地址。
Windows 服务安装在文件系统的什么位置?有没有办法重新配置配置文件以更改绑定/地址,而无需卸载/重新安装服务?
我一直在使用已发布的 web.config 文件来执行此操作,该文件存在于使用 IIS 的 WCF 服务的 inetpub 中,我想知道它是否与 Windows 服务相同。
I'm new to creating Windows Services to host WCF, as I've been using IIS to do this. I've created a Windows Service to host about a dozen of WCF services, and have set up an app.config file in Visual Studio to handle all the endpoints and addresses for each of the services.
Where on the file system are windows services installed? Is there a way to reconfigure the config file to change bindings/addresses without having to uninstall/reinstall the service?
I've been doing this with the published web.config file that is present in the inetpub for WCF services that are using IIS, I'm wondering if it's the same with a windows service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的标题问题的答案是肯定的。 Windows 服务的 app.config 与 IIS 托管 Web 服务的 web.config 相同。
Windows 服务通常作为常规可执行文件部署在产品特定路径内的某个位置。放置在该可执行文件旁边的 app.config 与附加了 .config 的可执行文件同名。因此,ScanService.exe 旁边有一个包含其配置的 ScanService.exe.config。
The answer to your title question is YES. The app.config to Windows Services is the same as the web.config is to IIS hosted web services.
Windows services are usually deployed as regular executable files in a certain place within a product specific path. The app.config placed next to this executable is with the same name as the executable appended with .config. So a ScanService.exe has a ScanService.exe.config next to it that contains its configuration.
Hans,我已经使用 Windows 服务开发/安装了我的分布式服务(.NET 远程处理),发生的情况是您需要在安装服务时指定文件夹。例如,您选择文件夹为“C:\Program Files\MyService”,那么您的 MyService.exe.config 将安装在与“C:\Program Files\MyService”相同的文件夹中,
这样您就可以找到“C:\Program Files\MyService” .exe.config”并修改您的绑定,然后重新启动您的 Windows 服务。
您考虑的其他要点是
这里不会有应用程序池,因此您在安装服务时使用的任何帐户都将用于运行您的服务。如果您使用简单的域\帐户,您可能需要提供一些额外的权限
如果您需要通过您的服务访问事件日志或注册表。
或者您可以在安装服务后稍后修改您的服务帐户。
您想要放弃 IIS 有什么特殊原因吗?由于我的 WCF 服务也存在于 IIS 中,因此想知道您是否遇到任何问题。
Hans , I have developed/installed my distributed services(.NET remoting) with as windows services, What happens is you need to specify folder while installing the service. eg you select the folder as "C:\Program Files\MyService" then your MyService.exe.config will be installed in same folder as "C:\Program Files\MyService"
so your can find "C:\Program Files\MyService.exe.config" and modify your bindings and then restart your windows service.
Other points you consider is
There will be no AppPool here so what ever account you will use while installing the services will be used to run your services. you may need to provide some additional permissions if you are using simple domain\account
in case you need to access event log or registry via your service.
Or in you can modify your service account later on after installing the services.
Is there any particular reason you want to move away from IIS ? As my WCF services also live in IIS so was wondering if you facing any issues with one.