Web Service .net 2.0,部署和使用
我使用 VS 2005 创建了一个单独的 Web 服务项目。
- 我的第一个问题是我可以添加多个服务 (asmx) 文件吗 并在单个 Web 服务项目中使用它们?
- 我如何发布它们并从不同的网站使用/调用/消费它们? (我知道当它们在同一个项目但不同时如何使用它们 项目有点令人困惑)
- 我如何保护它们以使经过身份验证的用户/应用程序可以使用它们?
使用 VS 2005、.net 2.0、VB.NET(并且我无法使用 WCF)
I created a separate web service project using VS 2005.
- My first question is can I add more than 1 service (asmx) files
and use them in single webservice project? - How can I publish them and use/call/consume them from different websites?
(I know how to use them when they are in same project but different
project is bit confusing) - How can I secure them to make them available by authenticated users/apps?
Using VS 2005, .net 2.0, VB.NET (and I cannot use WCF)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
wsdl.exe
)。wsdl.exe
).您可以向 Web 服务添加多个入口点,以便调用不同的 URL 将调用不同的行为。 添加 In 来实现此目的
您可以通过在 Service.cs 文件中的公共方法前面
您可以生成代码以基于 WSDL 文件与 Web 服务交互。我不确定在 .NET 中如何执行此操作,但在 Java 中,有一个命令行工具可以生成类以与其他应用程序中的 SOAP 服务进行交互。毕竟,这就是 Web 服务的全部意义。
您可能希望在 IIS 方面对此进行管理。虽然可能可以对您的 Web 服务进行一些基本身份验证,但检查用户名,但在访问 Web 服务之前处理此问题可能会更有效。
您还可以使用 Web.config 文件的身份验证属性配置基本身份验证。
You can add multiple entry points to your webservice, such that calling different URLs will call different behaviors. You can do this by adding
In front of public methods inside your Service.cs file.
You can generate code to interact with the webservice based on the WSDL file. I am not sure how you do this in .NET, but in Java there is a command line tool to generate class to interact with the SOAP service from another applications. This is, after all the entire point of web services.
You probably want to manage this on the IIS side of things. While it is probably possible to some basic authentication to your web service but checking the username, it may be more efficient to handle this before you reach your web service.
You can also configure basic authentication using the Web.config file's authentication attribute.