blank hostname for connections using .Net Core

Has anyone noticed (or hopefully fixed with a workaround) that connections to SQL from applications developed in .Net Core using the 'Core .Net SQL Data Provider' always have a blank hostname?

I've noticed this when using:
- DMVs such as sys.sessions, as by implication tools such as sp_whoisactive, sp_blitzwho etc
- Profiler (yes I still use it)
- Extended Events

At first I thought it was due to how the devs had constructed their connection strings (as you can manipulate this kind of data there), but on review they seemed 'normal'.

Is it due to the fact the .Net Core is platform agnostic? Is a server name a 'windows' thing? I do still see an IP address in sys.connections.

more ▼

asked Feb 07 at 03:53 PM in Default

avatar image

Kev Riley ♦♦
66.8k 48 65 81

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Very interesting indeed. Which version of .NET Core it is? There was an issue with the previous .NET Core version as pointed out here (Yes, I was helped out by the dev team :) ). We are developing new application based on .NET Core 2, but that is giving us the correct information about the HostName.

more ▼

answered Feb 08 at 11:45 AM

avatar image

Usman Butt
14.3k 6 13 21

Excellent! Thank you @Usman this would explain it!

Feb 08 at 12:02 PM Kev Riley ♦♦

BTW, now I owe the dev a cup of coffee at Gloria Jeans, but this is how it goes is in our environment. I had exploited the same quite a few times myself. :) But I am really glad, it helped. Cheers.

Feb 08 at 02:51 PM Usman Butt
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.



asked: Feb 07 at 03:53 PM

Seen: 45 times

Last Updated: Feb 08 at 02:51 PM

Copyright 2018 Redgate Software. Privacy Policy