web.config中的ASPNET.DB连接字符串 [英] ASPNET.DB connectionstring in web.config

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

问题描述

嗨 我上传了我的网站,但是当我想连接到数据库时发生错误.
我无法在web.config中为ASPNET.DB(登录数据库)设置连接字符串. 任何人都可以帮助我吗?

错误是:

"/"应用程序中的服务器错误.
建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.验证实例名称正确,并且已将SQL Server配置为允许远程连接. (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

解决方案

试图从线程中找到列表.
检查事项:
1.确保您的数据库引擎已配置为接受远程连接
*开始>所有程序> SQL Server 2005>配置工具> SQL Server外围应用配置器
*单击用于服务和连接的外围应用配置
*选择出现问题的实例>数据库引擎远程连接
*启用本地和远程连接
*重新启动实例

2.检查SQL Server服务帐户
*如果您没有将域帐户用作服务帐户(例如,如果您正在使用NETWORK SERVICE),则可能需要先切换此帐户,然后再继续操作

3.如果使用的是命名SQL Server实例,请确保在ASweb P.NET应用程序的连接字符串中使用该实例名称. *通常,指定数据库服务器所需的格式为machinename \ instancename
*还要检查您的连接字符串

< connectionstrings>

< add name = "  SampleConnectionString " " connectionstring =  "数据" 计算机名称\实例名称;初始"  catalog =" AdventureWorks;集成的  security =" SSPI; Min "  "  size =" " span> 超时=" 30" "  " /"  http: //www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config  [Server Error in '/' Application.
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. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Happen to find a list from a thread.
Things to check:
1. Make sure your database engine is configured to accept remote connections
*Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
* Click on Surface Area Configuration for Services and Connections
* Select the instance that is having a problem > Database Engine > Remote Connections
* Enable local and remote connections
* Restart instance

2. Check the SQL Server service account
* If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding

3. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
* Usually the format needed to specify the database server is machinename\instancename
* Check your connection string as well

<connectionstrings>

<add name=""SampleConnectionString"" connectionstring=""Data" source="machinename\instancename;Initial" catalog="AdventureWorks;Integrated" security="SSPI;Min" pool="" size="5;Max" timeout="30″" providername=""System.Data.SqlClient"/">

</add></connectionstrings>


4.You may need to create an exception on the firewall for the SQL Server instance and port you are using
* Start > Run > Firewall.cpl
* Click on exceptions tab
* Add the sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Binn), and port (default is 1433)
* Check your connection string as well

5. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings

6. Check SQLBrowser; check that it is running. You may also need to create an exception in your firewall for SQLBrowser.

7. Check that you have connectivity to the SQL Server. Note what you are using to connect: machine name, domain name or IP address? Use this when checking connectivity. For example if you are using myserver
* Start > Run > cmd
*netstat -ano| findstr 1433
*telnet myserver 1433
*ping -a myserver

Check what ports are IP addresses are being returned.

Alternative:
If you still can’t get any connection, you may want to create a SQL account on the server, a corresponding SQL user on the database in question, and just use this username/password combo in your web application.

Good luck


try this: http://www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config[^]


这篇关于web.config中的ASPNET.DB连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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