문제

I seem to have troubles to get my application (run from k) to connect to the database, this has occured after some changes i made to my SQLExpress instance and has probably something to do with the firewall.

The changes i made are as follows:

  1. I used to connect to the database using the sqlexpress instance name, i changed this to be able to use localhost, i went to sql server configuration, enabled TCP/IP and put the correct port in there, 1433. No problems here.

  2. I also created a new Login and user for my database, given it datareader and datawriter options.

The problem is i can connect to the database using localhost on sql server management studie, this works fine.

I can also connect using an internal tool, also using the localhost.

There is 2 problems i am not able to fix:

  1. The first problem lays in Visual studio, when i run my application there, i get unable to connect errors. I tried running without debugging and this solves the problem as windows asked me if i would allow my application to make changes blabla. Running with debugging doesnt ask me the same question but just throws me the error, hence i think this one is firewall related, when i disable my firewall completely it works.

  2. Im getting cannot open connection database errors, this ofcourse when i run without debugging to avoid previous problem, somehow my application cant seem to find the database when i try connecting via localhost, as said before, i can connect via localhost using sql management studio.

Any help would be appreciated, thanks in advance!

도움이 되었습니까?

해결책

Ive reinstalled the sqlserver this solved the issue. I can now work with localhost, though its not the solution i was looking for.

다른 팁

Try to switch off UAC. Helped for me

Try to run visual studio as administrator.

Right click on VS icon and choose run as administrator.

Or take a look at this question: Point to localhost\sqlexpress using only localhost

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top