Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
viperbyte
Posting Yak Master
132 Posts |
Posted - 2011-07-18 : 19:51:04
|
Hello everyone. I just recently installed IIS on a win7 pc and am having a hard time getting my asp.net app to connect to the database. When I run the app through Visual Studio I connect to the local Sql Express 2005 database just fine. I thought I could just simply install the same unaltered web.config file along with the rest of the source files into a directory such as c:\inetpub\wwwroot\tireworldfiles and everything would work. tireworldfiles is the folder with all the source files and I map it to an alias name of tireworld. I'm begining to think that there's more to this than I thought. Can someone super duper please help me out with this? |
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2011-07-19 : 06:57:42
|
Visual Studio has a publish option which will copy the relevant files to the location you specify. You should then be able to browse to it.steve-----------What color do you want that database? |
 |
|
rai.dharm
Starting Member
2 Posts |
Posted - 2011-07-19 : 08:33:20
|
You have to create a same database in the sql server and use the following in web.config file<appSettings> <!--<add key="const" value="data source=192.168.xxx.xxx;user id=sa;password=;initial catalog=databasename" />--> <add key="const" value="data source=.;user id=sa;password=xxx;initial catalog=databasename"/> <add key="constdoc" value="data source=192.168.xxx.xxx;user id=sa;password=xxx;initial catalog=databasename"/> </appSettings>Hope this will help Also you have to publish your application through IIS.run> inetmgrDBA |
 |
|
rai.dharm
Starting Member
2 Posts |
Posted - 2011-07-19 : 08:34:43
|
quote: Originally posted by viperbyte Hello everyone. I just recently installed IIS on a win7 pc and am having a hard time getting my asp.net app to connect to the database. When I run the app through Visual Studio I connect to the local Sql Express 2005 database just fine. I thought I could just simply install the same unaltered web.config file along with the rest of the source files into a directory such as c:\inetpub\wwwroot\tireworldfiles and everything would work. tireworldfiles is the folder with all the source files and I map it to an alias name of tireworld. I'm begining to think that there's more to this than I thought. Can someone super duper please help me out with this?
You have to create a same database in the sql server and use the following in web.config file<appSettings> <!--<add key="const" value="data source=192.168.xxx.xxx;user id=sa;password=;initial catalog=databasename" />--> <add key="const" value="data source=.;user id=sa;password=xxx;initial catalog=databasename"/> <add key="constdoc" value="data source=192.168.xxx.xxx;user id=sa;password=xxx;initial catalog=databasename"/> </appSettings>Hope this will help Also you have to publish your application through IIS.run> inetmgrDBA |
 |
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2011-07-19 : 08:50:28
|
I suspect that your web.config uses Integrated Authentication, i.e. uses the context of your Windows login to access the database. When you run the application from Visual Studio, the built-in web server (formerly known as Cassini) runs in the security context of your own login. Whereas when you deploy the files to a directory and run them through IIS, it tries to access the database through the security context of the ASPNET worker process (defined by your application pool). If this is indeed your issue, then there are two approaches to fix this:- Use an SQL Login (you will need to configure SQL Server to allow SQL logins, create the login and grant access permissions to the database)- Run your application pool under a different windows login and provide the necessary permissions for your database to the loginA quick search on Google should provide more details.OS |
 |
|
viperbyte
Posting Yak Master
132 Posts |
Posted - 2011-07-19 : 12:57:25
|
Your suspect was correct mohdowais. I used your first suggestion because the second one with application pool seemed more complicated than need be. This is not a production webserver. It's just IIS on one of my computers where I can test the apps on IIS instead of webdevserver. Thank you guys very much I hope you people have a great day. I sure will because of your guys help :) |
 |
|
|
|
|