0

I've built a web application using VS 2015. While testing my application I simply run my application from visual studio. Everything works fine. Then when I hosted my application to IIS in my own local machine, the application cannot connect to SQL Server. I've not changed the web.config file and the authentication mode of SQL Server is Windows Authentication mode.

I checked the sql profiler, the profiler shows the executed stored procedures when I run my application from visual studio, but when I run my application under IIS, it does not shows any executed stored procedures.

Please can anyone help me what is the problem? I am stuck with this problem for few days, please help me guys!!!

2
  • 2
    when you run it from Visual studio its using your Windows credentials to connect. You have access to the database so its all good. When running from IIS its using the process user's credentials... likely that user doesn't have permissions. Commented Sep 15, 2016 at 7:48
  • Enable log information into your application and then check log file for any exception. You should also check the issue by changing to SQL Authentication Mode. Commented Sep 15, 2016 at 8:20

2 Answers 2

1

You have 2 solutions:

1) as Andrii Matus gave solution to change application pool identity in your IIS server, and

2) use default sql user "sa" or create new sql user "dev", then give rights to "dev" sql user for read/write operations and then user "dev" in your connection string in IIS as well as visual studio.

NOTE: if sql is not allowing you to connect with "sa" account then you have to enable "sa" account and set new password also.

Sign up to request clarification or add additional context in comments.

2 Comments

I am trying to enable the "sa" user. the management studio shows default password for sa user. What is the default password of sa user in ms sql?
you need to provide new password for sa account if you are enabling "sa" account first time.
0

Well, I can suggest you to look on application pool identity on your IIS, and configure it to run under windows account with access to your SQL DB.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.