kandi X-RAY | service-fabric-aspnetcore Summary
kandi X-RAY | service-fabric-aspnetcore Summary
This repo contains ASP.NET Core integration for Service Fabric Reliable Services.
Top functions reviewed by kandi - BETA
service-fabric-aspnetcore Key Features
service-fabric-aspnetcore Examples and Code Snippets
Trending Discussions on service-fabric-aspnetcore
The last couple of days I've been hunting down a problem - with the conclusion:
My Visual Studio 2017 debugger can't work with PDBs in "portable" format in .NET Framework projects.
With portable format I mean going to a project's settings, then to
Advanced and then selecting
When I start debugging a .NET Framework project built like this, breakpoints don't get hit.
When I pause the debugger and look for the reason why it didn't load the symbols, it says (under
Symbol load information):
PDB format is not supported
I can reproduce this with any .NET Framework project. The target framework doesn't seem to matter. I tried .NET 4.5.2 and 4.6.2.
It works fine, though, for .NET Core projects.
Now, the strange thing is that the exact same project works fine on another computer.
So, it seems that my computer is missing something or has something misconfigured. But my Google search didn't turn up anything. Any ideas how to fix this problem?...
ANSWERAnswered 2019-Mar-11 at 18:37
You are probably using the wrong debugging engine.
Navigate: Tools > Options > Debugging > General
Ensure that the "Use Managed Compatibility Mode" is not ticked.
I'm working on an implementation of
ICommunicationClient and accompanying stuff for HTTP protocol communication which should be compatible with SF reverse proxy. The most subtle part for me is retry policy. According to Azure docs for 404 errors reverse proxy relies on X-Service-Fabric header to be returned from web service when deciding if it should retry.
ASP.NET Core provides middleware for integration with a reverse proxy which adds X-Service-Fabric header to every 404 response.
Assume we have the scenario when
ServicePartitionClient cached the endpoint for a stateless service listening on port 3001. At some point, this service may be moved to another node. On the first node, the Service Fabric runtime allocates a different service with its own endpoints but using the same middleware and listening on the same 3001 port.
When a client tries to call the original service at its old (cached) address it will receive 404 response containing the
X-Service-Fabric header. According to reverse proxy policies it shouldn't retry, but for me, it seems like the client will stay connected to the wrong service forever and won't attempt to re-resolve the endpoint.
I can't find any information about this case in the documentation, did I miss something here? Is it safe to rely on this standard middleware and don't do retry attempts on 404 errors with X-Service-Fabric: ResourceNotFound header?...
ANSWERAnswered 2018-Feb-28 at 22:11
In your given scenario, when your Client encounters a 404, the
X-Service-Fabric:ResourceNotFound header isn't the only attribute your code could examine when deciding whether or not to retry some operation.
To simplistically address your concern that your client won't be able to tell the difference between a "friendly" node and a "newly arrived" node, and since you're already working with http headers, you could add a custom HTTP header to outgoing responses to identify that a request comes from your application. When the client receives a 404, you can simply check for the presence of your custom header to answer the question of whether or not it's a "legit" retry. Of course, adding a custom HTTP header just for the sake of this validation check may be more of a global solution to a local problem. Ed: goes without saying that this should not be used to make security decisions by the application
A more elegant and complex means of accomplishing the same would be to deduce the same result using a different combination of HTTP headers and response attributes (e.g., see if some other headers are expected/unexpected), but this could also be a hyper-local solution to the problem.
This seems to say that is is always necessary otherwise you may resolve an incorrect service -- as there is no guarantee that services won't move around etc...
The default asp.net core service template uses
Is there a reason for this? When is it okay to not use the
E: I see these are actually a flags enum. So likely you should always use UseUniqueServiceUrl https://github.com/Azure/service-fabric-aspnetcore/blob/develop/src/Microsoft.ServiceFabric.AspNetCore/WebHostBuilderServiceFabricExtension.cs...
ANSWERAnswered 2017-Apr-30 at 03:10
Respectfully, I don't think you have read the docs well enough. It is well explained here:
Services that use a dynamically-assigned port should make use of this middleware.
Services that use a fixed unique port do not have this problem in a cooperative environment. A fixed unique port is typically used for externally-facing services that need a well-known port for client applications to connect to. For example, most Internet-facing web applications will use port 80 or 443 for web browser connections. In this case, the unique identifier should not be enabled.
So summarized: when using Kestrel or WebListener you can choose to use a dynamic port or a fixed port. See the sections Use WebListener/Kestrel with a static port and Use WebListener/Kestrel with a dynamic port in the mentioned link. When you opt to use a dynamic port use
ServiceFabricIntegrationOptions.UseUniqueServiceUrl, otherwise use
ServiceFabricIntegrationOptions.None as the parameter for the middleware.
Now, as of the why you need this unique service url middleware in case of a dynamic port, there is a scenario that describes the possible problem:
If services use dynamically-assigned application ports, a service replica may coincidentally use the same IP:port endpoint of another service that was previously on the same physical or virtual machine. This can cause a client to mistakely connect to the wrong service. This can happen if the following sequence of events occur:
- Service A listens on 10.0.0.1:30000 over HTTP.
- Client resolves Service A and gets address 10.0.0.1:30000
- Service A moves to a different node.
- Service B is placed on 10.0.0.1 and coincidentally uses the same port 30000.
- Client attempts to connect to service A with cached address 10.0.0.1:30000.
- Client is now successfully connected to service B not realizing it is connected to the wrong service.
This can cause bugs at random times that can be difficult to diagnose
No vulnerabilities reported
Reuse Trending Solutions
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page