简体   繁体   English

IIS 7.5 MVC 5部署的网站将无法连接到SQL Server

[英]IIS 7.5 MVC 5 deployed website will not connect to SQL Server

I have an ASP.NET MVC 5 website that works fine when it is running locally, but when deployed to the IIS 7.5 web server, it will not access SQL Server to pull up necessary information for the page. 我有一个ASP.NET MVC 5网站,该网站在本地运行时可以正常工作,但是当部署到IIS 7.5 Web服务器时,它将无法访问SQL Server来获取页面的必要信息。

The error it give says it is not able to get the connection settings from the web.config file. 它给出的错误表明它无法从web.config文件获取连接设置。 When I use the connection settings directly in the DB call, however; 但是,当我直接在数据库调用中使用连接设置时; I do not get the error, but no information at all is pulled from the DB. 我没有收到该错误,但是根本没有从数据库中获取任何信息。

Here is my connection string if that helps: 这是我的连接字符串,如果有帮助的话:

server=servername;database=dbName;uid=Id;pwd=password

Can someone give me an idea of how I can correct the error? 有人可以告诉我如何纠正错误吗?

Thank you in advance for all your help... 预先感谢您的所有帮助...

Finally solved it ... I believe the problem was that I originally configured it as a web app in the Default website in IIS and it was looking at the web.config for the Default website and not finding the access string it required to access the SQL server. 最终解决了它。我相信问题是我最初将其配置为IIS中默认网站中的Web应用程序,并且它正在查找默认网站的web.config,而未找到访问该网站所需的访问字符串。 SQL服务器。

I made it it's own website and everything is running fine now... 我将其设为自己的网站,并且现在一切正常...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM