Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Calling two Web Api methods: one already hangs

$
0
0

Hi,

I have two web api controllers both defining a web api method. When executing these two web methods directly one after the other I get a timout for always the same web api method. My logging tells me, that the web api method causing the timeout is not called. IIS log also has no log entry for the web api method call provoking the time out.

If I call the two web methods independent of each other with some seconds delay, both methods are called.

Any idea, why the second web api method does not get called?

Here the two web api methods in different web api controllers:

This one always executes:

[HttpPut]
[EnableCors(origins: "http://81.169.xxx.xxx,http://xxx.net", headers: "*", methods: "*")]
public async Task RefreshSecuritiesWebView()
{    this.logHelper.WriteInfo("Executing 'RefreshSecuritiesWebView'");    using (new LogTimer(this.logHelper, "'RefreshSecuritiesWebView' called."))    {        var command = new RefreshSecuritiesWebViewTableCommand();        try        {            await this.commandService.ExecuteCommandHandler(command);            await this.memoryCache.RefreshCacheAsync<SecurityWebViewTable>();        }        catch (Exception ex)        {            this.logHelper.WriteError(ex.FullExceptionMessage());            throw;        }    }
}

This one "hangs":

[HttpPut]
[EnableCors(origins: "http://81.169.xxx.xxx,xxx.net", headers: "*", methods: "*")]public async Task RefreshPortfolioPositionsCurrentViewTable()
{    this.logHelper.WriteInfo("Executing 'PortfolioPositionsCurrentViewTable'");    using (new LogTimer(this.logHelper, "'PortfolioPositionsCurrentViewTable' called."))    {        var command = new RefreshPortfolioPositionsCurrentViewTableCommand();        try        {            await this.commandService.ExecuteCommandHandler(command);            await this.memoryCache.RefreshCacheAsync<PortfolioCurrentSummaryView>();            await this.memoryCache.RefreshCacheAsync<PortfolioPositionsCurrentWebView>();        }        catch (Exception ex)        {            this.logHelper.WriteError(ex.FullExceptionMessage());            throw;        }    }
}

And here is how I call the "hanging" web api method on a client:

public void TriggerPortfolioPositionsCurrentWebViewTableUpdate()
{    var url = ConfigurationManager.AppSettings["UrlBase"] + "api/Portfolios/RefreshPortfolioPositionsCurrentViewTable";    using (new LogTimer(logHelper, "Updating portfolios current web view and refreshing cache by requesting web api {0}.", url))    {        HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;        request.Method = "PUT";        request.ContentLength = 0;        try        {            request.GetResponse();        }        catch (System.Exception ex)        {            logHelper.WriteError(ex.FullExceptionMessage());            throw;        }    }
}

Thank you,

Torsten


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>