Data Source=localhost 或者=127.0.0.1为什么都连接不到数据库?只有=.的时候可以,我用的是SQL2008
DataSource=localhost/实例名可以连接.但是用ip不行...因为我想局域网内都可以连接到我的数据库...
Data Source=localhost/实例名 可以连接.但是用ip不行...因为我想局域网内都可以连接到我的数据库
展开
展开全部
你 hosts 文件没有定义
[C:\WINDOWS\system32\drivers\etc]type hosts
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
[C:\WINDOWS\system32\drivers\etc]
[C:\WINDOWS\system32\drivers\etc]type hosts
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost
[C:\WINDOWS\system32\drivers\etc]
追问
改成和你一样后、还是不能通过127.0.0.1链接数据库
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
DNS没解析吧,用local
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询