简体   繁体   English

Visual Studio 2010中的ASP.Net WebService在哪里?

[英]Where's the ASP.Net WebService in Visual Studio 2010?

I am trying to create my first webservice. 我正在尝试创建我的第一个Web服务。 I've been googling for a tutorial or examples and most of what I find is from previous versions of Visual Studio and say to create a new ASP.Net Webservice...but that doesn't exist in 2010! 我一直在谷歌搜索教程或示例,我发现的大部分内容来自以前版本的Visual Studio,并说要创建一个新的ASP.Net Webservice ...但这在2010年不存在!

What I need to do is have the service receive 2 strings, an agency and a man number. 我需要做的是让服务接收2个字符串,代理商和人员编号。 Then run a query to get some information and return a string with a date and time back to the requestor. 然后运行查询以获取一些信息,并将带有日期和时间的字符串返回给请求者。 I need to have a web interface available to call the service as well. 我需要有一个Web界面来调用该服务。

Any guidance on what I need to do to create the service in Visual Studio 2010 in C# will be appreciated! 有关在C#中使用Visual Studio 2010创建服务需要做什么的任何指导将不胜感激!

Update: I've just been told that this process needs to authenticate the users...can someone guide me to information on implementing certificate or digital signatures into my web service? 更新:我刚刚被告知此过程需要对用户进行身份验证...有人可以指导我将有关在我的网络服务中实施证书或数字签名的信息? I've looked but most of what I'm finding is for authenticating through Active Directory or some other maintained list with usernames and passwords. 我看过,但我发现的大部分内容都是通过Active Directory或其他一些带有用户名和密码的维护列表进行身份验证。

This puzzled me too. 这也让我很困惑。 There's another puzzle to be had when you try and add a reference to an ASP.NET Web Service too, but I'll let you have fun with that one. 当你尝试添加对ASP.NET Web服务的引用时,还有另一个难题,但是我会让你玩得很开心。

Change the target framework version in the dropdown list to .NET framework 2 and choose Web on the left hand side when creating a new project and it will appear. 将下拉列表中的目标框架版本更改为.NET framework 2并在创建新项目时在左侧选择Web ,它将出现。


Actually, I'm not going to be mean. 实际上,我不会是卑鄙的。 If you are going to reference the web service from an application built using.NET 3.0 or higher: 如果要从使用.NET 3.0或更高版本构建的应用程序引用Web服务:

  1. Go to Add Service Reference 转到Add Service Reference
  2. Go to Advanced 转到高级
  3. Click Add Web Reference at the bottom of the dialog. 单击对话框底部的“添加Web引用”。

In VS 2010, you can't create web services because this is covered with WCF services. 在VS 2010中,您无法创建Web服务,因为这包含在WCF服务中。 To create ASP.NET Web Services, you need to select ASP.NET app with Framework 3.5. 要创建ASP.NET Web服务,您需要选择带有Framework 3.5的ASP.NET应用程序。

Visual Studio 2010 SP1,.NET Framwework 4.0您需要创建ASP.NET网站 ,然后添加新项目 ,然后从Web选项卡模板Web Service中进行选择。

Consider creating a WCF service instead. 请考虑创建WCF服务。 This is the evolutionary successor of the 'bare' Webservice. 这是'裸'Webservice的进化继承者。

When you configure the WCF server with BasicHttpBinfing you have a (SOAP) Webservice. 使用BasicHttpBinfing配置WCF服务器时,您有一个(SOAP)Web服务。 Other binding-types (including more advanced WS-* webservices) only require changes in the config. 其他绑定类型(包括更高级的WS- * webservices)只需要更改配置。

But for an old-style ASMX based webservice you can follow fletchers answer. 但对于旧式的基于ASMX的Web服务,您可以关注fletchers的答案。

It looks like Microsoft have removed the ability to create Web Services with Visual Studio 2010 Ultimate SP1. 看起来Microsoft已经删除了使用Visual Studio 2010 Ultimate SP1创建Web服务的功能。

It does not matter what framework you are using (2, 3, 3.5, 4) the option is not available. 无论您使用哪种框架(2,3,3.5,4),该选项都不可用。 It is unknown at this time why Microsoft made such a move. 目前尚不清楚为什么微软采取了这样的行动。 They have been hush hush over it for a while now. 他们已经嘘了一会儿。

THE BELOW SIMPLE STEPS WORKED THE BEST FOR ME.... 以下简单的步骤对我来说是最好的....

  1. create an empty website 创建一个空网站
  2. rightclick -> add New item 右键单击 - >添加新项目
  3. and select Web Service . 并选择Web服务。

This will create a empty webservice. 这将创建一个空的Web服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM