[英]How to host a WCF Service in IIS Programatically?
I have a WCF 3.0 service which has been configured in the web.config
of my web application where it's hosted via an .svc
file: 我有一个WCF 3.0服务,该服务已在通过
.svc
文件托管的Web应用程序的web.config
中进行了配置:
<endpoint address="https://domain.co.uk/services/accountservice"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAccountService"
contract="AccountServiceReference.IAccountService"
name="BasicHttpBinding_IAccountService" />
The address value shouldn't be in plain text in the web.config, as we'd like to encrypt it with an encryption algorithm that we have and only store the encrypted value there. 地址值不应在web.config中以纯文本格式显示,因为我们希望使用已有的加密算法对其进行加密,并且仅将加密后的值存储在该地址中。 How would that be possible?
那怎么可能呢?
I was thinking perhaps I should be programmatically hosting the WCF service in our IIS so that the address can be set at runtime by reading the EncryptedAddress
value from an AppSetting
then decrypting it at runtime. 我在想,也许我应该以编程方式在我们的IIS中托管WCF服务,以便可以在运行时通过从
AppSetting
读取EncryptedAddress
值来设置地址,然后在运行时对其进行解密。 How would that be possible? 那怎么可能呢?
There are already several answers to your question in stack overflow, for example: 在堆栈溢出中,您的问题已经有多个答案,例如:
How to programatically set a single endpoint for a WCF service 如何以编程方式为WCF服务设置单个端点
How can I register a WCF service programmatically within an IIS environment 如何在IIS环境中以编程方式注册WCF服务
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.