MyDataService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Data.Services;
using System.Data.Services.Common;
namespace DemoHostingInConsole
{
public class MyDataService : DataService<StudentDBEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
}
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Data.Services;
using System.Data.Services.Common;
namespace DemoHostingInConsole
{
class Program
{
static void Main(string[] args)
{
WebServiceHost host = new WebServiceHost(typeof(MyDataService),
new Uri("http://localhost:9786/MyService"));
WebHttpBinding binding = new WebHttpBinding();
host.AddServiceEndpoint(typeof(IRequestHandler), binding, "abc");
host.Open();
Console.WriteLine("Service is running at http://localhost:9786/MyService ");
Console.WriteLine("To stop the service press a Key ");
Console.ReadKey();
host.Close();
}
}
}
I hope post was useful. Happy Coding
HTTP could not register URL http://+:9093/MyService/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
what is solution for this problem in wcf service…..