Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

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

$
0
0

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)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class MonthlyBenefitList : System.Web.Services.WebService
    {

        [WebMethod]
        public DataTable GetBenefitMonthlyList(string ListMonth, int ListType)
        {
            var conString = ConfigurationManager.ConnectionStrings["TrackingConnectionString"].ConnectionString;

            using (SqlConnection connection = new SqlConnection(conString))
            {
                connection.Open();

                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);
                DtAdapt.Fill(DT);
                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?


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>