Database Connection Issue While Profiling

I'm new to ANTS so I may be doing something wrong that's easy to fix....but I tried doing a profiling session for a .NET Framework-based Web API hosted under IIS (all local testing for now). The profiling session starts up, but when I start calling my APIs, I keep getting a database connection error. If I don't have the profiler hooked in, the call works successfully. Any ideas why this would be happening?
Tagged:

Best Answer

  • AlexanderMzAlexanderMz Posts: 4 Bronze 1
    Accepted Answer
    @JasonBock for the latter exception, find LineLevelBlacklist.xml file (%LocalAppData%\Red Gate\ANTS Performance Profiler 10\LineLevelBlacklist.xml) and put the following line there:
      <assemblyName>System.Net.Http</assemblyName>




Answers

  • Just to clarify - everything is running on the same server as APP?
    Have you visited our Help Centre?
  • JasonBockJasonBock Posts: 10 Bronze 2
    Yep, this is all my local dev environment.
  • AlexanderMzAlexanderMz Posts: 4 Bronze 1
    edited January 14, 2019 2:07PM
    Hi Jason, most likely your SQL server uses Windows/AD authentication. You should run you profiler under account having access to Sql.
    Check "Show server options/Manually specify ASP account details" setting when starting profiling.
  • JasonBockJasonBock Posts: 10 Bronze 2
    So here's what I tried. I went into the profiling configuration and tried to change "Manually specify ASP account details".

    If I don't use the same account used for the app pool that the API runs under, I get this error (the REDACTED is client-specific info):

    [SqlException]: Cannot open database &quot;REDACTED&quot; requested by the login. The login failed.
    Login failed for user &#39;REDACTED$&#39;.


    If I use the same account used for the app pool that the API runs under, I get this error:

    [MethodAccessException]: Attempt by security transparent method &#39;System.Net.Http.HttpClient.FinishSendAsync(System.Threading.Tasks.Task`1&lt;System.Net.Http.HttpResponseMessage&gt;, System.Net.Http.HttpRequestMessage, System.Threading.CancellationTokenSource, Boolean)&#39; to call native code through method &#39;&lt;Module&gt;._ANTS_Begin_Async()&#39; failed.  Methods must be security critical or security safe-critical to call native code.

    So....not sure where to go from here. Any other ideas? Or am I not setting the profiling session up correctly?

  • JasonBockJasonBock Posts: 10 Bronze 2
    I'll give that a whirl...
  • JasonBockJasonBock Posts: 10 Bronze 2
    AleanderMz, that did the trick! Thanks for the help.
Sign In or Register to comment.