skip to Main Content

I want to create a web service in Visual Studio 2019 using C# and .NET, but I could not find option of web service – neither in ASP.NET Core nor the .NET framework. Can someone help me with this?

2

Answers


  1. To create a simple web service using this template:

    Step-1: In Visual Studio, create a new project using the ASP.NET Web Application (.NET Framework) template, and select the Empty template when prompted. Type a name and create the project.

    Step-2: In Solution Explorer, right-click the project node, choose Add > New Item, and then choose Web Service (ASMX). Add the web service.

    Step-3: Open WebService1.asmx and replace the default HelloWorld web method with the following code.

    public string HelloWorld(string str)
    {
      return "Hello, " + str;
    }
    
    Login or Signup to reply.
  2. Its likely you have chosen .net core as project type when creating the project. You need to choose Web applications. Check the image below.enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search