WCF托管在Windows服务和httpbindings

时间:2019-02-07 10:52:08

标签: wcf windows-services wshttpbinding

我正在处理Windows服务中托管的WCF。它的工作原理就像一种魅力,但现在我需要像IIS一样为此wcf保留一个特定的主机名。 更清楚地说,我的托管wcf运行在Windows服务器计算机上,该计算机响应多个dns名称,但是我需要让wcf仅可从这些dns之一访问。如果我使用的是IIS,则可以通过在http绑定设置中设置特定的主机名来实现,但是不幸的是,我无法像这样管理我的wcf。 据您所知,是否有任何方法可以为IIS外部的托管wcf保留特定的主机名?

谢谢!

1 个答案:

答案 0 :(得分:0)

是的,您可以通过使用以下命令在内核级别(http.sys)注册http端点来完成此操作

debug = false

logLevel = "DEBUG"
defaultEntryPoints = ["https","http"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]
    [[entryPoints.https.tls.certificates]]
      certFile = "/etc/certs/wekan1.crt"
      keyFile = "/etc/certs/wekan1.key"
  [entryPoints.eightzero]
  address = ":8080"

[api]
entrypoint = "eightzero"


[retry]

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "bla.localhost"
watch = true
exposedbydefault = false

然后仅在该特定dns /主机名上,您的http服务才会侦听。

相关问题