2

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;
        }
    }
 }
abatishchev
  • 98,240
  • 88
  • 296
  • 433
Rhendar
  • 410
  • 7
  • 25
  • 1
    do you have the `ReportExecution` referenced? – Daniel A. White Mar 04 '19 at 18:50
  • 3
    "Add Reference" in your MSVS project: Project > Add Reference > Assemblies, Framework > and click on System.Web.Services. – paulsm4 Mar 04 '19 at 18:50
  • That fixed the System.Web.Services but it's still saying it cannot find ReportExecutionServices. I looked for it in the same spot I found the System.Web.Services reference but nothing came up. What else am I missing? – Rhendar Mar 04 '19 at 18:54

1 Answers1

5

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

Aditya Bhave
  • 998
  • 1
  • 5
  • 10