I have a service fabric (on-premises) application written in .NET Framework 4.6.1 with one service with WebAPI using OWIN. When I make wrong request (bad uri) to api on local machine cluster it gives me 404 not found but when I deploy it to server and try same uri it takes some time and finally give FABRIC_E_TIMEOUT. I tried to add some custom IHttpControllerSelector and IHttpActionSelector like in this article https://dzone.com/articles/handling-http-404-error-aspnet but it was not helping. What can I do to make app on server work like on local cluster and return 404 immidiatelly?
Asked
Active
Viewed 756 times
1
-
3I found solution - here https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reverseproxy in section "Special handling for port-sharing services". I added additional header X-ServiceFabric=ResourceNotFound and now it works – dnf May 28 '18 at 11:26
-
where and how did you add the header, could you please elaborate? – Harshad Vyawahare Oct 12 '18 at 13:17
-
2you can return this i controller: var response = new HttpResponseMessage(System.Net.HttpStatusCode.NotFound) { Content = new StringContent(resourceHint) }; response.Headers.Add("X-ServiceFabric", "ResourceNotFound"); – dnf Oct 12 '18 at 17:38