本地数据库连接字符串 [英] Local Database Connection String

查看:108
本文介绍了本地数据库连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有经典的ASP.Net网络应用程序,我的连接字符串在webconfig文件中。我将此发布到我的iis服务器8.当我运行iis应用程序时,Web应用程序无法连接本地数据库。



我该怎么办? IIS应用程序池设置或Web配置连接字符串设置?



我的iis服务器URL是localhost:8082,我无法连接我的数据库。



非常感谢

Hi everyone,

I have classical ASP.Net web application, and my Connection string is in webconfig file. I published this to my iis server 8. When i run the iis application, the web application can not connect the local database.

What should i do for the connection? IIS Application pool settings or Web config Connection string settings?

My iis server url is localhost:8082 and i could not connect my Database.

Thanks a lot

推荐答案

数据库连接不依赖于本地iis服务器/ iisexpress或其他东西。它取决于您存储在任何可以访问它并以编程方式读取的任何位置的正确连接字符串。没有metter它是web.config或不。但通常我们将它存储在web.config文件中,以便使用System.ConfigurationManager类轻松读取。您的问题是在发布时,您无法从应用程序连接到数据库。如果是这样,请在发布您的网站后首先检查您的web.config文件。如果从文件系统中检查它会更好。表示部署Web应用程序文件的方法。在该web.config文件中包含它包含的值以及它们是否真正有效。您可以从应用程序中编写一些代码并编写一些日志,以便在发布时找到它找到的连接字符串,并使用try catch块并详细编写此异常的日志,以便您可以确定问题所在。
Database connectivity not depends on your local iis server/iisexpress or other things. It is depends on proper connection string which you store anywhere there you can access it and programatically read. No metter it is web.config or not. But usually we store it web.config file for easily read using System.ConfigurationManager class. Your problem is when you publish it, you can not connect to the database from your applicaton. If so please first check your web.config file after publishing your site. It would be better if you check it from file system. Means where your web application files are deployed. In that web.config files what the value it contains and that are really valid or not. You can write some code from your application and write some logs what connection string it finds when published and use try catch block and write log of this exception in details so that you can identify what the problem is.


这篇关于本地数据库连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆