从Win7启动位于NW驱动器上的C#exe时出现“错误26-错误定位服务器";微软SQL [英] ‘error 26 - error locating server’ when launching C# exe located on NW drive from Win7; MSSQL

查看:89
本文介绍了从Win7启动位于NW驱动器上的C#exe时出现“错误26-错误定位服务器";微软SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个使用 LINQ to SQL类的C#程序.如果我将exe文件放在网络驱动器上并从那里执行它们,我会收到"错误26 ","",但只有当我从Win7中执行该操作时,.

I have several C# programs utilizing LINQ to SQL classes. If I put the exe files on a network drive and execute them from there, I get the ‘error 26’, but only when I do it from Win7.

逐步

  1. 创建一个新的C#项目(我在XP计算机上使用VS 2010 Premium). 添加新的"LINQ to SQL类".将一些表格拖放到 数据上下文(来自服务器资源管理器).我正在使用的数据库 都是远程服务器上的MSSQL.

  1. Create a new C# project (I use VS 2010 Premium on an XP machine). Add new ‘LINQ to SQL classes’. Drag and drop some table into the data context (from the server explorer). The database(s) I’m using are all MSSQL on remote servers.

关于以下问题:连接字符串包含带有 明文密码且未使用集成安全性…",请选择

On the question: "The connection string contains credentials with a clear text password and is not using integrated security…", select Yes

利用数据上下文在程序中进行一些LINQ查询. 确保程序正常运行.

Make some LINQ query in the program, utilizing the data context. Make sure the program works.

将exe放在(映射的)网络驱动器上

Put the exe on a (mapped) network drive

(从NW位置)执行exe

Execute the exe (from the NW location)

连接字符串(由系统创建)如下所示(从VS项目中可以看到的位置;属性->设置):

The connection string (as created by the system) looks as follows (from where it can be seen in the VS project; Properties -> Settings):

数据源= SERVERNAME \ INSTANCE;初始目录= INITIAL_CATALOG;持久安全信息=正确;用户ID = USER_ID;密码=密码

注释

  • [在XP计算机上]在本地启动exe(c驱动器)= 确定
  • [在XP计算机上]从NW驱动器启动exe = 确定
  • [在Win7机器上]在本地启动exe(C驱动器)= 确定
  • [在Win7计算机上]从NW驱动器启动exe = 不稳定(错误26…)
  • [On XP machine] Launch exe locally (c drive)= OK
  • [On XP machine] Launch exe from NW drive = OK
  • [On Win7 machine] Launch exe locally (c drive) = OK
  • [On Win7 machine] Launch exe from NW drive = NOT OK (error 26…)

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

Error message: 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)

推荐答案

没有.解决此错误的方法.然而.如果您使用的是64位(新的Windows 7系统,使用SQL BI Development Studio),则必须在SQL Native Client 10.0配置(32位)下添加别名.还要检查此链接.它可能会有所帮助: http://sqlerrormessages.blogspot.in/2009/12/specified-sql-server-not-found-or-error.html

There are a no. of ways to solve this error. However. if you are using a 64 bit (new Windows 7 system, using SQL BI Development Studio)you must add your aliases under SQL Native Client 10.0 Configuration (32 bit). Check this link too.It may help : http://sqlerrormessages.blogspot.in/2009/12/specified-sql-server-not-found-or-error.html

这篇关于从Win7启动位于NW驱动器上的C#exe时出现“错误26-错误定位服务器";微软SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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