I have a WCF Service application created in VS 2010. When I execute it, I got the service page in the following local url
I created another self hosting console application as shown below. It is throwing following exception
HTTP could not register URL. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
Well, I have no particular interest in the 49609 port number. I just copied it from the other working service.
Now, I have bare minimum rights for running the WCF service. What change I need to do to make the following code to succeed?
Note: There is no chance for me to get the administrator rights in this machine.
Note: I am fine with any port number that will work.
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string baseAddress = "http://" + Environment.MachineName + ":49609/Service";
ServiceHost host1 = new ServiceHost(typeof(Service1), new Uri(baseAddress));
host1.AddServiceEndpoint(typeof(ConsoleApplication1.IService1), new BasicHttpBinding(), baseAddress);
host1.Open();
}
static Binding GetBinding()
{
BasicHttpBinding result = new BasicHttpBinding();
return result;
}
}
}
Service
public class Service1 : IService1
{
public int Add(int n1, int n2)
{
return n1 + n2;
}
}
[ServiceContract]
public interface IService1
{
[OperationContract]
int Add(int n1, int n2);
}