简体   繁体   中英

Connection string in plain text and config file

At the moment I have my connectionstrings in plain text in my code for development purposes. Everything works lik a charm. However if I move my connection strings to a remote config file the following sql error appears :

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

I tried printing the connectionstring and it was identical to the one I had in plain text.

ConnString = "Initial Catalog=###;Persist Security Info=True;User ID=###;Password=###";
ConnFromFile = WebConfigurationManager.AppSettings["ConnString"];
Log.Message(ConnString ==ConnFromFile )

This resulted in True.

=> SQL配置管理器,检查tcp / IP,启用命名管道,并且禁用VIA

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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