繁体   English   中英

如何在Visual Studio 2013中配置SQL Server以允许远程连接

[英]How to configure SQL Server in Visual Studio 2013 to allow remote connection

我正在使用Visual Studio2013。我正在尝试创建WCF服务。 在这项服务中,我有一个数据库。 当我运行此服务时,它将返回数据。 但是,当我从客户端应用程序尝试时,出现异常。 我正在使用默认的Visual Studio 2013 SQL Server。 谁能帮帮我吗? 有什么问题,我该如何解决?

错误:

建立与SQL Server的连接时发生与网络相关或特定于实例的错误。 服务器未找到或无法访问。 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (提供者:SQL网络接口,错误:50-发生本地数据库运行时错误。无法创建自动实例。有关错误详细信息,请参见Windows应用程序事件日志。)
服务器堆栈跟踪:
在System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(消息回复,MessageFault错误,字符串操作,MessageVersion版本,FaultConverter faultConverter)
在System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime操作,ProxyRpc&rpc)
在System.ServiceModel.Channels.ServiceChannel.Call处(字符串操作,布尔单向,ProxyOperationRuntime操作,Object [] ins,Object [] outs,TimeSpan超时)
在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)
在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)

异常重新抛出为[0]:
在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)
在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)
在WindowsApplication1.ServiceReference1.IService1.login上(字符串ID,字符串密码)
在WindowsApplication1.ServiceReference1.Service1Client.login(String id,String password)中的e:\\ study \\ 7thsemister \\ Paint app \\ Paint app \\ Service References \\ ServiceReference1 \\ Reference.cs:line 77中
在WindowsApplication1.login.login_btn_Click(Object sender,EventArgs e)中的e:\\ study \\ 7thsemister \\ Paint app \\ Paint app \\ login.cs:line 26中

如果访问数据库的代码与SQL Server数据库本身不在同一台计算机上,则可能需要在数据库上启用远程连接,或者修改SQL Server网络配置以允许使用网络协议。 若要启用远程连接,请从SQL Server Management Studio(在数据库服务器上)打开数据库服务器的属性,然后选择“允许到该服务器的远程连接”。 要启用网络协议,请打开“ SQL Server网络配置”应用程序并启用诸如“ TCP / IP”之类的协议。

这是一篇带有详细说明的文章: http : //blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

首先检查您的防火墙设置。 如果您的问题仍然存在,请检查客户端代理设置。 还检查您从客户端的sql server连接。 为此,创建一个新的文本文件并将filename.txt更改为filename.udl,现在运行它并检查您的连接。

如果您的问题不能解决,请提供您的代码。

暂无
暂无

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

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