C# ASP.NET Web 服务模板不存在?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19023487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 13:55:42  来源:igfitidea点击:

ASP.NET Web Service template not exist?

c#asp.netvisual-studio-2010web-services.net-4.0

提问by Samiey Mehdi

I have a full installation of Visual Studio 2010with .Net framework 4. I want create my first web service. but not exist web servicetemplate.
In visual studio 2010 I go to File-> New Web Sitemenu , but in the New Web Sitedialog box not exist ASP.NET Web Servicetemplate.

我完整安装了带有.Net framework 4Visual Studio 2010。我想创建我的第一个 Web 服务。但不存在Web 服务模板。 在 Visual Studio 2010 中,我转到File-> New Web Site菜单,但在New Web Site对话框中不存在ASP.NET Web Service模板。

enter image description here

在此处输入图片说明

How to create a Web Service?

如何创建 Web 服务?

采纳答案by John Saunders

Use File->New Project->WCF Service Application.

使用文件->新建项目->WCF 服务应用程序。

"ASP.NET Web Services" (aka ASMX) is a legacy technology. It exists only to support existing ASMX services. Do not use it for new development.

“ASP.NET Web 服务”(又名 ASMX)是一项遗留技术。它的存在只是为了支持现有的 ASMX 服务。不要将它用于新的开发。

回答by Damith

create ASP.net Empty Web Site and add asmx file. that's it.

创建 ASP.net 空网站并添加 asmx 文件。就是这样。

Or You can Target the .Net Framework to 3.5 when you create the project and web service template available for .net 3.5, create the project and re target it to 4.0 or 4.5

或者,您可以在创建可用于 .net 3.5 的项目和 Web 服务模板时将 .Net Framework 定位到 3.5,创建项目并将其重新定位到 4.0 或 4.5

But You better move to Windows Communication Foundation (WCF)

但是你最好转向Windows Communication Foundation (WCF)

回答by Sasidharan

File > New Project > Visual C# > Web Service Application

You can create multiple projects under one solution..
create a web service,build and run it.
Then create another webapplication under the same solution file.
Add reference..
Thats it..

您可以在一个解决方案下创建多个项目..
创建一个 Web 服务,构建并运行它。
然后在同一个解决方案文件下创建另一个 web 应用程序。
添加参考..就是
这样..

回答by pals

Go to File --> New -->Asp.Net Empty Web application. on that Right click --> Add New item - >webservice template

转到文件 --> 新建 --> Asp.Net 空 Web 应用程序。在那个右键单击--> 添加新项目-> webservice 模板