WCF 帮助页面 - 如何禁用或更改显示的 URL

发布于 2024-12-11 18:02:49 字数 488 浏览 0 评论 0原文

我在 SO 和 Google 上搜索了类似的问题,但当您浏览到 *.svc 文件时,似乎无法隐藏或禁用标准 WCF 帮助页面“您已创建服务”。

我们面临的问题是,它在行中显示了我们的服务器名称和域名:

“要测试此服务,您将需要...”

svcutil.exe http://machinename.companydomain.local/CARS.Service/ServiceCARS.svc?wsdl

如您所见,这里显示了服务器的名称以及我们的域名。公司域名。即使您使用 IP 或本地主机浏览到该服务,它也会获取此信息。

这是一项面向外部的服务,我们不希望在组织外部提供这些详细信息。我试图摆弄 设置,但这似乎并没有改变这个“帮助”(黑客)页面上显示的内容。

那么有什么想法吗?如何完全禁用页面或隐藏页面中的计算机名称和域名?

I've searched for similar questions on SO and Google, but seems like it's not possible to hide or disable the standard WCF help page "You have created a service" when you browse to your *.svc file.

The problem for us is that it shows our server name and domain name in the line where it says:

"To test this service, you will need to..."

svcutil.exe http://machinename.companydomain.local/CARS.Service/ServiceCARS.svc?wsdl

As you can see, here it shows the server's name as well as our company domain name. It picks this up even if you browse to the service with an IP or localhost.

This is an external facing service and we do not want those details to be made available outside the orginization. I have tried to fiddle with the <dns value=localhost"> setting, but that does not seem to change what is displayed on this "help" (the hackers) page.

So any ideas? How to either disable the page completely or to hide the machine name and domain name from the page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风吹过旳痕迹 2024-12-18 18:02:49

要完全禁用该页面:在 web.config 上,使用 http[s]HelpPageEnabled 定义 内的 行为 属性设置为 false。

  <system.serviceModel>
    <services>
      <service name="MyNamespace.MyService" behaviorConfiguration="NoHelpPageBehavior">
        <endpoint address="" binding="basicHttpBinding" contract="MyNamespace.IMyContract" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="NoHelpPageBehavior">
          <serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

To disable the page completely: on web.config, define the <serviceDebug/> behavior inside a <serviceBehavior> with the http[s]HelpPageEnabled properties set to false.

  <system.serviceModel>
    <services>
      <service name="MyNamespace.MyService" behaviorConfiguration="NoHelpPageBehavior">
        <endpoint address="" binding="basicHttpBinding" contract="MyNamespace.IMyContract" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="NoHelpPageBehavior">
          <serviceDebug httpHelpPageEnabled="false" httpsHelpPageEnabled="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文