ASP.NET cannot connect to SQL Server database on the same machine












0















I have a local SQL Server database setup on a Dell R720 running Windows Server 2012 R2 and I am developing an ASP.NET site. I am able to connect to the database and pull in objects and queries and everything EXCEPT when I try to pull in the login tool.



I was following a tutorial on creating a login page and they suggested pulling in this tool, and clicking the login button which will prompt visual studio to create a new database with a bunch of tables in it, which they did successfully in the video but when I try it, I get this response:




A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)




Here is my web.config file:



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SOSiQConnectionString"
connectionString="Data Source=KINGDOM_NETWORK;Initial Catalog=SOSiQ;Integrated Security=true;"
providerName="System.Data.SqlClient" />
<!-- commented this out testing the connection
<add name="SOSiQConnectionString1"
connectionString="Data Source=localhost;Initial Catalog=SOSiQ;Integrated Security=True"
providerName="System.Data.SqlClient" /> -->
</connectionStrings>


Visual studio code showing SQL Server database connection



PS, I have searched google for days looking for a solution. Everybody suggests making sure that you have remote connections enabled and firewall/ports. I've done all that to no avail, but, in my mind it shouldn't matter because A. I am on the machine that has the SQL Server database and B. I can access the database from my project in Visual Studio.










share|improve this question




















  • 1





    For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for Data Source=) of either . (just a dot), or (local) (including the parenthesis), or localhost (but without the trailing backslash that you have in your second connection string)

    – marc_s
    Dec 30 '18 at 22:12













  • Please follow all these steps mentioned here & if still you have same problem then to connect sql using IP

    – J Sushil
    Dec 31 '18 at 6:23











  • Marc and Sushil thank you i will try both of those and let you know.

    – Truth is a person
    Dec 31 '18 at 21:56











  • So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project.

    – Truth is a person
    Jan 1 at 1:26











  • Maybe this will help clarify? reddit.com/r/homelab/comments/abecew/…

    – Truth is a person
    Jan 1 at 3:12
















0















I have a local SQL Server database setup on a Dell R720 running Windows Server 2012 R2 and I am developing an ASP.NET site. I am able to connect to the database and pull in objects and queries and everything EXCEPT when I try to pull in the login tool.



I was following a tutorial on creating a login page and they suggested pulling in this tool, and clicking the login button which will prompt visual studio to create a new database with a bunch of tables in it, which they did successfully in the video but when I try it, I get this response:




A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)




Here is my web.config file:



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SOSiQConnectionString"
connectionString="Data Source=KINGDOM_NETWORK;Initial Catalog=SOSiQ;Integrated Security=true;"
providerName="System.Data.SqlClient" />
<!-- commented this out testing the connection
<add name="SOSiQConnectionString1"
connectionString="Data Source=localhost;Initial Catalog=SOSiQ;Integrated Security=True"
providerName="System.Data.SqlClient" /> -->
</connectionStrings>


Visual studio code showing SQL Server database connection



PS, I have searched google for days looking for a solution. Everybody suggests making sure that you have remote connections enabled and firewall/ports. I've done all that to no avail, but, in my mind it shouldn't matter because A. I am on the machine that has the SQL Server database and B. I can access the database from my project in Visual Studio.










share|improve this question




















  • 1





    For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for Data Source=) of either . (just a dot), or (local) (including the parenthesis), or localhost (but without the trailing backslash that you have in your second connection string)

    – marc_s
    Dec 30 '18 at 22:12













  • Please follow all these steps mentioned here & if still you have same problem then to connect sql using IP

    – J Sushil
    Dec 31 '18 at 6:23











  • Marc and Sushil thank you i will try both of those and let you know.

    – Truth is a person
    Dec 31 '18 at 21:56











  • So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project.

    – Truth is a person
    Jan 1 at 1:26











  • Maybe this will help clarify? reddit.com/r/homelab/comments/abecew/…

    – Truth is a person
    Jan 1 at 3:12














0












0








0








I have a local SQL Server database setup on a Dell R720 running Windows Server 2012 R2 and I am developing an ASP.NET site. I am able to connect to the database and pull in objects and queries and everything EXCEPT when I try to pull in the login tool.



I was following a tutorial on creating a login page and they suggested pulling in this tool, and clicking the login button which will prompt visual studio to create a new database with a bunch of tables in it, which they did successfully in the video but when I try it, I get this response:




A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)




Here is my web.config file:



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SOSiQConnectionString"
connectionString="Data Source=KINGDOM_NETWORK;Initial Catalog=SOSiQ;Integrated Security=true;"
providerName="System.Data.SqlClient" />
<!-- commented this out testing the connection
<add name="SOSiQConnectionString1"
connectionString="Data Source=localhost;Initial Catalog=SOSiQ;Integrated Security=True"
providerName="System.Data.SqlClient" /> -->
</connectionStrings>


Visual studio code showing SQL Server database connection



PS, I have searched google for days looking for a solution. Everybody suggests making sure that you have remote connections enabled and firewall/ports. I've done all that to no avail, but, in my mind it shouldn't matter because A. I am on the machine that has the SQL Server database and B. I can access the database from my project in Visual Studio.










share|improve this question
















I have a local SQL Server database setup on a Dell R720 running Windows Server 2012 R2 and I am developing an ASP.NET site. I am able to connect to the database and pull in objects and queries and everything EXCEPT when I try to pull in the login tool.



I was following a tutorial on creating a login page and they suggested pulling in this tool, and clicking the login button which will prompt visual studio to create a new database with a bunch of tables in it, which they did successfully in the video but when I try it, I get this response:




A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)




Here is my web.config file:



<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SOSiQConnectionString"
connectionString="Data Source=KINGDOM_NETWORK;Initial Catalog=SOSiQ;Integrated Security=true;"
providerName="System.Data.SqlClient" />
<!-- commented this out testing the connection
<add name="SOSiQConnectionString1"
connectionString="Data Source=localhost;Initial Catalog=SOSiQ;Integrated Security=True"
providerName="System.Data.SqlClient" /> -->
</connectionStrings>


Visual studio code showing SQL Server database connection



PS, I have searched google for days looking for a solution. Everybody suggests making sure that you have remote connections enabled and firewall/ports. I've done all that to no avail, but, in my mind it shouldn't matter because A. I am on the machine that has the SQL Server database and B. I can access the database from my project in Visual Studio.







asp.net vb.net ssms-2014






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 30 '18 at 21:53









marc_s

580k13011191266




580k13011191266










asked Dec 30 '18 at 21:29









Truth is a personTruth is a person

1




1








  • 1





    For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for Data Source=) of either . (just a dot), or (local) (including the parenthesis), or localhost (but without the trailing backslash that you have in your second connection string)

    – marc_s
    Dec 30 '18 at 22:12













  • Please follow all these steps mentioned here & if still you have same problem then to connect sql using IP

    – J Sushil
    Dec 31 '18 at 6:23











  • Marc and Sushil thank you i will try both of those and let you know.

    – Truth is a person
    Dec 31 '18 at 21:56











  • So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project.

    – Truth is a person
    Jan 1 at 1:26











  • Maybe this will help clarify? reddit.com/r/homelab/comments/abecew/…

    – Truth is a person
    Jan 1 at 3:12














  • 1





    For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for Data Source=) of either . (just a dot), or (local) (including the parenthesis), or localhost (but without the trailing backslash that you have in your second connection string)

    – marc_s
    Dec 30 '18 at 22:12













  • Please follow all these steps mentioned here & if still you have same problem then to connect sql using IP

    – J Sushil
    Dec 31 '18 at 6:23











  • Marc and Sushil thank you i will try both of those and let you know.

    – Truth is a person
    Dec 31 '18 at 21:56











  • So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project.

    – Truth is a person
    Jan 1 at 1:26











  • Maybe this will help clarify? reddit.com/r/homelab/comments/abecew/…

    – Truth is a person
    Jan 1 at 3:12








1




1





For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for Data Source=) of either . (just a dot), or (local) (including the parenthesis), or localhost (but without the trailing backslash that you have in your second connection string)

– marc_s
Dec 30 '18 at 22:12







For connection to a SQL Server on the same machine, I'd recommend using a server/instance name (value for Data Source=) of either . (just a dot), or (local) (including the parenthesis), or localhost (but without the trailing backslash that you have in your second connection string)

– marc_s
Dec 30 '18 at 22:12















Please follow all these steps mentioned here & if still you have same problem then to connect sql using IP

– J Sushil
Dec 31 '18 at 6:23





Please follow all these steps mentioned here & if still you have same problem then to connect sql using IP

– J Sushil
Dec 31 '18 at 6:23













Marc and Sushil thank you i will try both of those and let you know.

– Truth is a person
Dec 31 '18 at 21:56





Marc and Sushil thank you i will try both of those and let you know.

– Truth is a person
Dec 31 '18 at 21:56













So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project.

– Truth is a person
Jan 1 at 1:26





So.....I dont think i am explaining the issue well. Ive run through all of those steps. Still get that error message when i click the login button. I dont have any issues connecting to the DB from any of my other pages in my project.

– Truth is a person
Jan 1 at 1:26













Maybe this will help clarify? reddit.com/r/homelab/comments/abecew/…

– Truth is a person
Jan 1 at 3:12





Maybe this will help clarify? reddit.com/r/homelab/comments/abecew/…

– Truth is a person
Jan 1 at 3:12












1 Answer
1






active

oldest

votes


















0














Download SQL Server Express, even if you have a Standard or an Enterprise version already.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53981573%2fasp-net-cannot-connect-to-sql-server-database-on-the-same-machine%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Download SQL Server Express, even if you have a Standard or an Enterprise version already.






    share|improve this answer






























      0














      Download SQL Server Express, even if you have a Standard or an Enterprise version already.






      share|improve this answer




























        0












        0








        0







        Download SQL Server Express, even if you have a Standard or an Enterprise version already.






        share|improve this answer















        Download SQL Server Express, even if you have a Standard or an Enterprise version already.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 13 at 21:35









        marc_s

        580k13011191266




        580k13011191266










        answered Jan 1 at 8:55









        Truth is a personTruth is a person

        1




        1
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53981573%2fasp-net-cannot-connect-to-sql-server-database-on-the-same-machine%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith