保护.NET Web服务URLNET、Web、URL

2023-09-07 03:56:28 作者:梦境依稀沉沦

我已经用Asp.net 3.5创建的Web服务。现在,它的工作完美的实时Windows服务器,并给了我完美的XML在调用它使用一些URL如:

I have created Web Service using Asp.net 3.5. Now it's working perfectly in live windows server, and giving me perfect xml while invoking it using some url like :

http://www.somedomain.com/Service.asmx?op=fetchData

现在我的问题是,当我访问的网址,如:

Now My question is when I am accessing url like :

http://www.somedomain.com/Service.asmx

它的上市我创建的Web服务。

it's listing my created web services.

如果我不想列表中上下可用的Web服务提供给最终用户。

What if I don't wanna list down the available web services to end users.

在此先感谢...

推荐答案

如果您只想禁用该服务帮助页面,然后添加以下web.config文件的system.web节:

If you just want to disable the service help page then add the following to the system.web section of web.config:

<webServices>
   <wsdlHelpGenerator href="HideServices.aspx"/>
</webServices>

在这里HideServices.aspx是包含要显示,当有人试图浏览 HTTP内容的页面: //www.somedomain.com/Service.asmx (也可能是空的或通用的消息)。

where HideServices.aspx is a page that contains the content you want to display when someone tries to browse http://www.somedomain.com/Service.asmx (it could be blank or a generic message).

以上的配置并留下生成WSDL通过启用?WSDL(http://www.somedomain.com/Service.asmx?WSDL)。如果您还不想成为你的WSDL,然后,而不是添加以下的web.config的system.web节:

The above config does leave WSDL generation enabled via ?WSDL (http://www.somedomain.com/Service.asmx?WSDL). If you also don't want to serve up your WSDL then instead add the following to the system.web section of web.config:

<webServices>
  <protocols>
    <remove name="Documentation" />
  </protocols>
</webServices>