Azure / azure-notificationhubs-dotnet

.NET SDK for Azure Notification Hubs
MIT License
70 stars 119 forks source link

[BUG] Getting Timeout from .NET Framework ASP.Net Web API Project #198

Closed cbolivar82 closed 2 years ago

cbolivar82 commented 3 years ago

Describe the bug

We realized that our API is getting a timeout when it is trying to invoice 'DeleteInstallation()' method, here is a code example from API controller:

using Microsoft.Azure.NotificationHubs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace WebApplication1.Controllers
{
  public class ValuesController : ApiController
  {
    // GET api/values
    public IEnumerable<string> Get()
    {
      return new string[] { "value1", "value2" };
    }
    // GET api/values/5
    public string Get(int id)
    {
      var srv = NotificationHubClient.CreateClientFromConnectionString("Endpoint=sb://xxxxxxx", "yyyyy");

      srv.DeleteInstallation("450a57c1-37ae-451e-b364-886ace9fa826");

      return "Ok!";
    }
  }
}

if you add a breakpoint in "srv.DeleteInstallation("450a57c1-37ae-451e-b364-886ace9fa826");", it will keep running and it will get a request timeout in the browser.

On the other hand, I did another test from a console app with the same logic, and the code run perfectly, here is my example:

using Microsoft.Azure.NotificationHubs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
  class Program
  {
    static void Main(string[] args)
    {
      var srv = NotificationHubClient.CreateClientFromConnectionString("Endpoint=sb://xxxxxxx", "yyyyy");

      srv.DeleteInstallation("450a57c1-37ae-451e-b364-886ace9fa826");
    }
  }
}

The issue is in the .NET Framework ASP.NET Web API project is getting a timeout for "DeleteInstallation()", we are having the same error with "InstallationExists()" as well.

Both projects is using these specifications:

Exception or Stack Trace Add the exception log and stack trace if available

To Reproduce

Expected behavior API project will be able to complete the request and run the Azure Hub Message methods.

Additional context This bug is currently happening in production at our azure app service, it was working fine but at some point, it started failing.

mpodwysocki commented 2 years ago

This is a service based issue and not based upon code. If this persists, please open a ticket on the Azure Portal to have the case reviewd.