Hi team, I have made a wcf service with asp.net website. service runs on localhost,but the page default.aspx which is linked to the service doesn't run. please help me in this regards. IService:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
// NOTE: If you change the interface name "IService" here, you must also update the reference to "IService" in Web.config.
[ServiceContract]
public interface IService
{
[OperationContract]
string hello(string m);
}
Service.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
// NOTE: If you change the class name "Service" here, you must also update the reference to "Service" in Web.config and in the associated .svc file.
public class Service : IService
{
public string hello(string n)
{
return n;
}
}
Default.aspx:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ServiceModel;
namespace MyWebSite
{
public partial class _Default : System.Web.UI.Page
{
//MyService.ServiceClient client = new MyWebSite.localhost.ServiceClient();
localhost.Service cl = new MyWebSite.localhost.Service();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1\_Click(object sender, EventArgs e)
{
string name = TextBox1.Text;
Response.Write("Hello....."+cl.hello(name));
}
}
}