I published the website to IIS virtual directory, and it can't connect to sql server?!!
What is the damn problem with this?!
What authentication are you using?
If using Windows Authentication (SSPI/Integrated Security), then you'll need to grant database access to the ASPNET account that the ASP.NET worker process uses.
If you are using integrated security or SSPI for SQL Authentication, you will need to add NETWORK_SERVICE as an allowed login to the DB