1

In my apps, I am using SqlDataSourceEnumerator.Instance.GetDataSources() to enumerate the sql servers on local networks.

I had VS 2010 pro and Sql Server 2008 R2 Express and SSMS 2008 R2 Express and VS 2013 Pro. Everything was ok. Then I installed VS 2015 Community Edition, removed VS 2013 Pro. Then my apps and SSMS starts return nothing for enumarating sql servers on local network. Then I removed (uninstalled through Programs and Features) every thing related with Sql Server 2008 R2 Express and re-installed it, but this time installed the SSMS 2014 Express Edition not SSMS 2008 R2 Express.

Now I have VS 2010 Pro (that I should keep it at least for a while) and Sql Server 2008 R2 Express and SSMS 2014 Express and VS 2015 community Edition. Even If I built my apps with VS 2010 Pro or VS 2015 targeting to .Net 4.0, my apps can not enumarate the sql servers. SSMS 2014 can not either. But on the command line osql -L and sqlcmd -L enumarating the sql servers on my local network. SSMS 2014 can see the my local Sql Server 2008 R2 and connect seamlessly.

I did things with sql server configuration manager to enable tcp/ip and named pipes enable, default port to 1433, login mode to mixed etc. Even be sure that windows firewall is allowing the sql ports and sql server browser is running.

What can be the reason that I can not numerate the sql servers with SqlDataSourceEnumerator.Instance.GetDataSources() and SSMS also can not see the network sql servers?

2
  • -same application runs normal on a different computer which has no .net 4.6 Aug 4, 2015 at 16:44
  • .Net 4.6 has a bug which broke all 4.x runtime versions of GetDataSources. Please let MS know that you're having this problem also so they'll fix it: Microsoft connect
    – kjbartel
    Aug 10, 2015 at 2:36

2 Answers 2

0

Same Issue here. I enumerate SQL Servers with SqlDataSourceEnumerator.Instance.GetDataSources() and right after installing VS2015 Enterprise the call always returns nothing. I have SQL Server 2014 Enterprise installed.

0

This is a Framework issue. If you set your application target framework to Net 3.5 then SqlDataSourceEnumerator works. I̶'̶m̶ ̶s̶t̶i̶l̶l̶ ̶l̶o̶o̶k̶i̶n̶g̶ ̶f̶o̶r̶ ̶a̶ ̶w̶o̶r̶k̶a̶r̶o̶u̶n̶d̶ ̶f̶o̶r̶ ̶N̶e̶t̶ ̶4̶ ̶a̶n̶d̶ ̶h̶i̶g̶h̶e̶r̶.̶ - Its a bug

Although the MSDN article states for only SQL 2000 ~ 2005, It does say Net 4.6, 4.5, 4 are supported.

Added

Its been reported as a bug for Windows 10 & Net 4.x

1
  • Although the MSDN article states for only SQL 2000 ~ 2005, I have been enumerating sql server 2000 ~ 2014 with my c# app targeting to Net 4.0. Unfortunately, setting my app target to Net 3.5 is not an option for me. Since It has been reported as a bug to Microsoft, we need to wait for them to resolve the issue hopefully A.S.A.P. Aug 11, 2015 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.