c# - "Request is not available in this context" when debugging with Visual Studio 2017 -


i upgraded visual studio 2015 visual studio 2017. following code runs when deployed azure app services , when debug visual studio 2015. when debugging in visual studio 2017, throws exception:

request not available in context

for vs2015 , vs2017 iis express used debugging. vs2017 iis 10.0 express (10.0.1737) installed, not remember version used vs2015.

the code c# based on asp.net 4.5.2 azure api app template. registers receiver subscribing events azure event hub.

using system; using system.web.http; using system.web.http.cors; using system.configuration; using microsoft.azure.eventhubs; using microsoft.azure.eventhubs.processor; using microsoft.applicationinsights; using system.collections.generic;  namespace ....  public static class webapiconfig     {         public static void register(httpconfiguration config)         {             // web api configuration , services             config.enablecors();             // web api routes             config.maphttpattributeroutes();              try             {                 console.writeline("registering eventprocessor...");                  ...                  var eventprocessorhost = new eventprocessorhost(                         ehentitypath,                         ehconsumergroup,                         ehconnectionstring,                         storageconnectionstring,                         storagecontainername                         );                  // registers event processor host , starts receiving messages                 eventprocessorhost.registereventprocessorasync<helper.eventprocessor>();              }             catch (exception ex) ... 

the exception thrown @ line

eventprocessorhost.registereventprocessorasync<helper.eventprocessor>();  

but issue seems not related azure event hub. because exception in global.asax.cs when trying create application insights event:

new telemetryclient().trackevent("application started"); 

i know there other posts regarding exception "request not available in context" seems special behavior of vs2017.

my local environment is:

microsoft visual studio enterprise 2017  version 15.2 (26430.16) release visualstudio.15.release/15.2.0+26430.16 microsoft .net framework version 4.7.02046  installed version: enterprise  visual c# 2017   00369-60000-00001-aa377 microsoft visual c# 2017  application insights tools visual studio package   8.6.00404.2 application insights tools visual studio  asp.net , web tools 2017   15.0.30503.0 asp.net , web tools 2017  asp.net web frameworks , tools 2017   5.2.50303.0  azure app service tools v3.0.0   15.0.30209.0 azure app service tools v3.0.0  common azure tools   1.9 

according description, created asp.net 4.5.2 azure api app application on side , debugged on vs2015 (enterprise, version 14.0.25431.01 update 3) , vs2017 (enterprise preview, version 15.3.0 preview 7.1) iis express (10.0.14358.100), both debug , custom events , metrics sent application insights.

based on issue, suggest starting application via vs without debugging narrow issue or use cmd.exe , run iisexpress /path:"c:\myapp\" /port:80 check whether application work expected.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -