Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find System.Web.Services

I have a basic MVC web application complete with a Web API that I'm attempting to use to run an existing SSRS report and save those results to a file. I'm following the example I found here but whenever I attempt to add the line "Using System.Web.Services;" I'm given the following error message: "The type or namespace 'Services' does not exist in the namespace System.Web." Do I need to add something to my project to reference System.Web.Services? I have to have System.Web.Services in order to use the ReportExecutionService.

Here's the code:

using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Routing;
using System.Web;
using System.Web.Services;

namespace TestAPI.Controllers
{
    public class PrintController : ApiController
    {
        [Authorize]
        [Route("api/PrintFile")]
        [HttpGet]
        public HttpResponseMessage PrintReport()
        {
            HttpResponseMessage returnValue = new 
            HttpResponseMessage(HttpStatusCode.OK);
            if (returnValue.StatusCode == HttpStatusCode.OK)
            {
                ReportExecutionService rs = new ReportExecutionService();
            }

            return returnValue;
        }
    }
 }
like image 580
Rhendar Avatar asked Sep 05 '25 01:09

Rhendar


1 Answers

Make sure you have a reference to System.Web.Services.dll

Refer - https://learn.microsoft.com/en-us/dotnet/api/system.web.services.webservice?view=netframework-4.7.2

like image 182
Aditya Bhave Avatar answered Sep 07 '25 11:09

Aditya Bhave