Hi,
I'm working on an app and I need to provide a web interface to it. I was thinking about using WCF to provide a service for the web interface, and self-host both with my app (no IIS). Now, if those two are not using the same port, the browser will complain about XSS...
Is this possible? Is this a good idea?
EDIT After some investigation, I've managed to make it work.
Here's the webservice self-host code:
var serviceHost = new ServiceHost(typeof(CalculatorService));
serviceHost.AddServiceEndpoint(typeof (ICalculator), new WSHttpBinding(), "http://localhost:8000/webservice");
serviceHost.Open();
Console.WriteLine("CalcService is running.");
Console.WriteLine("Press Enter to terminate the service.");
Console.ReadLine();
serviceHost.Close();
And here's the web host code:
var listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8000/webconsole/");
listener.Start();
Console.WriteLine("listening");
while(true)
{
HttpListenerContext context = listener.GetContext();
/* ... */
}
For the webservice to work, I needed to do this