microsoft / service-fabric-issues

This repo is for the reporting of issues found with Azure Service Fabric.
168 stars 21 forks source link

Service without Endpoint #34

Closed senj closed 8 years ago

senj commented 8 years ago

Hello,

I'm trying to find a way to use Service Fabric Services without opening any endpoint. E.g. if they should process something or receive messages via message queue.

I tried to remove the whole

   <Resources>
      <Endpoints>
         <Endpoint Name="Endpoint" Protocol="http" Type="Input" />
      </Endpoints>
   </Resources>

part in ServiceManifest and also modified the CreateServiceInstanceListener like this:

 protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
        {
            return new List<ServiceInstanceListener>();
        }

I'm using Asp.Net Core. First I thought it works because I had one service without endpoint. But when I tried to deploy a second this fails

communicationContext.WebHost.Run();

with


Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4091 EADDRINUSE address already in use
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.Check(Int32 statusCode)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvTcpHandle.GetSockIPEndPoint()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.TcpListenerPrimary.CreateListenSocket()
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Listener.<>c.<StartAsync>b__6_0(Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.ListenerPrimary.<StartAsync>d__11.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.CreateServer(ServerAddress address)
   at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Start[TContext](IHttpApplication`1 application)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at Tts.Microservices.Geocoder.Program.Main(String[] args) in 

Process is terminated due to StackOverflowException.

It seems that the service is still using some "hidden" address ..?

ghost commented 8 years ago

Use the "Stateless Service" or "Stateful Service" template in Visual Studio to generate a project rather than the "Stateless Web API" or "ASP.NET Core" template. The default application generated for this will result in a service without an endpoint.

senj commented 8 years ago

Okay thank you I found it.

I still have to use the Endpoint in my Kestrel, but the Endpoint may be empty.