Web Sevice works perfectly on browser and returns accurate data when invoked. However, when added it to project it doesn't generates the reference .CS file RRS feed

  • Question

  • User-786564416 posted

    I have the following Web Service that I run on browser and invoked it. It returns accurate data as XML.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Data;
    using System.Data.SqlClient;
    using System.Configuration;
    using System.Diagnostics;
    using System.Threading;
    namespace WebServiceApp
        /// <summary>
        /// Summary description for MonthlyBenefitList
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        public class MonthlyBenefitList : System.Web.Services.WebService
            public DataTable GetBenefitMonthlyList(string ListMonth, int ListType)
                var conString = ConfigurationManager.ConnectionStrings["TrackingConnectionString"].ConnectionString;
                using (SqlConnection connection = new SqlConnection(conString))
                    DataTable DT = new DataTable();
                    //string queryString = "SELECT * FROM ExternalEntities WHERE (Type=@Type)";
                    string queryString = "SELECT * FROM ExternalEntities";
                    SqlCommand BuildCmd = new SqlCommand(queryString, connection);
                    BuildCmd.Parameters.Add("@Type", SqlDbType.NVarChar);
                    BuildCmd.Parameters["@Type"].Value = "رسمي";
                    SqlDataAdapter DtAdapt = new SqlDataAdapter(BuildCmd);
                    DT.TableName = "BenefitMainList";
                    return DT;

    However, As shown in the following picture, When I want to start utilize it in a project and add it through Service Reference, it is added but the .CS file is not generated. So where is the problem and how can I use it without the CS file?

    Why is it not generated?

    Wednesday, July 24, 2019 5:15 PM


  • User475983607 posted

    You created a web site project.  Create a Web Application.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 24, 2019 5:36 PM