Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Endpoint is defined as in ServiceDefinition.csdef as
- // HTTP, external port 8080, internal port 8080 (or 8081 - error both ways)
- RoleInstanceEndpoint externalEndPoint =
- RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Endpoint"];
- string baseAddress= String.Format("http://{0}", externalEndPoint.IPEndpoint);
- var maxsize = 1024 * 1024;
- var config = new HttpSelfHostConfiguration(baseAddress)
- {
- MaxBufferSize = maxsize, MaxReceivedMessageSize = maxsize
- };
- config.Routes.MapHttpRoute(
- name: "DefaultApi",
- routeTemplate: "api/{controller}/{id}",
- defaults: new { id = RouteParameter.Optional }
- );
- // Create and open the server
- var server = new HttpSelfHostServer(config);
- server.OpenAsync().Wait();
- // keep the worker thread alive
- while (true)
- Thread.Sleep(Timeout);
- [0] One or more errors occurred.
- [1] HTTP could not register URL http://+:8081/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details).
- [2] Access is denied
- <Endpoints>
- <InputEndpoint name="Endpoint" protocol="http" port="8080" localPort="8081" />
- </Endpoints>
- host.AddServiceEndpoint(
- typeof(IEchoService), new BasicHttpBinding(BasicHttpSecurityMode.None) { HostNameComparisonMode = HostNameComparisonMode.Exact }, "echo");
- <WorkerRole name="WorkerRole" vmsize="ExtraSmall">
- <Runtime executionContext="elevated">
- </Runtime>
- </WorkerRole>
- <Startup>
- <Task executionContext="elevated" commandLine="startupInstall.cmd">
- <Environment>
- <Variable name="ENDPOINTPORT ">
- <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/Endpoints/Endpoint[@name='Endpoint']/@port" />
- </Variable>
- </Environment>
- </Task>
- </Startup>
- <Endpoints>
- <InputEndpoint name="Endpoint" protocol="http" port="8080" localPort="8080" />
- </Endpoints>
- netsh.exe http add urlacl url=http://+:%ENDPOINTPORT%/api user=everyone listen=yes delegate=yes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement