我在SO和Google上搜索过类似的问题,但是当您浏览*.svc文件时,似乎无法隐藏或禁用标准WCF帮助页面"您已创建服务".
我们面临的问题是,它在我们的行中显示了我们的服务器名称和域名:
"要测试这项服务,你需要......"
svcutil.exe http://machinename.companydomain.local/CARS.Service/ServiceCARS.svc?wsdl
Run Code Online (Sandbox Code Playgroud)
如您所见,此处显示服务器名称以及公司域名.即使您使用IP或localhost浏览到该服务,它也会选择此选项.
这是一个面向外部的服务,我们不希望在orginization之外提供这些细节.我试图摆弄这个<dns value=localhost">
设置,但这似乎并没有改变这个"帮助"(黑客)页面上显示的内容.
那么任何想法?如何完全禁用页面或隐藏页面中的机器名称和域名?
car*_*ira 15
要完全禁用该页面:在web.config上,定义a中的<serviceDebug/>
行为<serviceBehavior>
,并将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>
Run Code Online (Sandbox Code Playgroud)