pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

如果從網絡路徑執行 EXE,則 SqlConnection 錯誤

SqlConnection Error if EXE is executed from network path(如果從網絡路徑執行 EXE,則 SqlConnection 錯誤)
本文介紹了如果從網絡路徑執行 EXE,則 SqlConnection 錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

首先:您在這篇文章中讀到的所有內容在安裝了 Windows 10 April 2018 更新的情況下發生.安裝前更新卸載后都沒有問題.

First of all: everything you will read in this post happens only if Windows 10 April 2018 update is installed. No problem before installation and after update uninstallation.

安裝 Windows 10 1803 更新后,我所有從網絡映射驅動器或 UNC 路徑運行的 VB 程序(VB6、.NET 和 WPF)都無法連接到 SQL 服務器,如果在本地放置并執行相同的可執行文件,則沒問題驅動器(在同一網絡中的 2 臺電腦上測試):

After installing Windows 10 1803 update, all my VB program (VB6, .NET and WPF) running from network mapped drive or UNC path can't connect to SQL server, no problem if the same executable is placed and executed from local drive (tested on 2 pc in the same network):

  1. 遠程 SQL 服務器,本地驅動器上的 exe:OK
  2. 相同遠程 SQL 服務器,映射網絡驅動器上的 相同 exe(具有完全讀/寫訪問權限):錯誤
  1. Remote SQL server, exe on local drive: OK
  2. Same remote SQL server, same exe on mapped network drive (with full read/write access): ERROR

這是錯誤(可能對解決此問題沒有意義):

This is the error (maybe not significat to solve this problem):

與 SQL Server 建立連接時發生與網絡相關或特定于實例的錯誤.服務器未找到或無法訪問.驗證實例名稱是否正確以及 SQL Server 是否配置為允許遠程連接.(提供程序:SQL 網絡接口,錯誤:26 - 錯誤定位服務器/指定的實例).

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).

簡單的VB.NET代碼復現問題(將代碼放在一個簡單的形式,在button_click事件中加一個按鈕,設置值連接到SQL服務器,編譯,將exe文件保存在網絡路徑上并執行)):

Simple VB.NET code to reproduce the problem (place the code in a simple form with a button in the button_click event, set values to connect to the SQL server, compile, save the exe file on a network path and execute it):

Dim myConnectionString As String
Dim mySqlConnectionStringBuilder As New SqlConnectionStringBuilder()
mySqlConnectionStringBuilder.DataSource = myServer
mySqlConnectionStringBuilder.InitialCatalog = myDatabase
mySqlConnectionStringBuilder.UserID = myUtente
mySqlConnectionStringBuilder.Password = myPassword
myConnectionString = mySqlConnectionStringBuilder.ConnectionString

Dim mySqlConnection As New SqlConnection(myConnectionString)
mySqlConnection.Open()  <- error

異常:

System.Data.SqlClient.SqlException (0x80131904): Si è verificato un errore di rete o specifico dell'istanza mentre si cercava di stabilire una connessione con SQL Server. Il server non è stato trovato o non è accessibile. Verificare che il nome dell'istanza sia corretto e che SQL Server sia configurato in modo da consentire connessioni remote. (provider: SQL Network Interfaces, error: 26 - Errore nell'individuazione del server/dell'istanza specificata)
   in System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
   in System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   in System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   in System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   in System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   in System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
   in System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   in System.Data.SqlClient.SqlConnection.Open()
   in RiepilogoOreTimer.RiepilogoOreTimerWindow.ConnessioneOK()
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:-1,State:0,Class:20

有什么想法嗎?

更新:如果我卸載 2018 年 4 月的更新,問題就會消失,即使在網絡驅動器上執行該程序也能正常工作,但這不能成為解決方案...

Update: If I uninstall the April 2018 update the issue go away and the program works fine even if executed on a network drive, but this can't be the solution...

2018 年 8 月 5 日更新:我注意到 2018 年 4 月的更新帶來了一些 安全變化:

Update 08/05/2018: I noticed that April 2018 update brought some changes in security:

Windows 10 版本 1803 提供額外保護:

Windows 10, version 1803 provides additional protections:

  • 新的攻擊面減少規則
  • 受控文件夾訪問現在可以阻止磁盤扇區

這可能是問題的原因嗎?我不是安全經理,所以我不能說這是否會導致我的問題

Could it be the cause of the issue? I'm not a security manager so I can't say if this can cause my problem

2018 年 9 月 5 日更新:我在 this 帖子:

Windows 10 更新 1803 無法打開網絡連接SMBv1 共享上的可執行文件(如 Windows Server 2003)

Windows 10 update 1803 does not open network connections on executables files on SMBv1 share (as Windows Server 2003)

但我不知道什么是 SMBv1...有人可以幫助我嗎?

but I don't know what SMBv1 is... somebody can help me?

推薦答案

終于發現問題了:在共享文件夾的服務器中,SMBv2被禁用(不知道為什么)所以只有SMBv1處于活動狀態;從同一網絡中的同一客戶端執行的同一程序但位于啟用了 SMBv2 的服務器上運行正常.

Finally I found the problem: in the server with the shared folder, SMBv2 is disabled (I don't know why) so only SMBv1 is active; the same program executed from the same client in the same network but located on a server with SMBv2 enabled works fine.

所以問題是關于 SMBv1 共享,從 Windows 10 1803 開始??棄用

So the problem is about SMBv1 share, deprecated starting from Windows 10 1803

這篇關于如果從網絡路徑執行 EXE,則 SqlConnection 錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

What SQL Server Datatype Should I Use To Store A Byte[](我應該使用什么 SQL Server 數據類型來存儲字節 [])
Interpreting type codes in sys.objects in SQL Server(解釋 SQL Server 中 sys.objects 中的類型代碼)
Typeorm .loadRelationCountAndMap returns zeros(Typeorm .loadRelationCountAndMap 返回零)
MS SQL: Should ISDATE() Return quot;1quot; when Cannot Cast as Date?(MS SQL:ISDATE() 是否應該返回“1?什么時候不能投射為日期?)
Converting the name of a day to its integer representation(將一天的名稱轉換為其整數表示)
How to convert nvarchar m/d/yy to mm/dd/yyyy in SQL Server?(如何在 SQL Server 中將 nvarchar m/d/yy 轉換為 mm/dd/yyyy?)
主站蜘蛛池模板: jrs高清nba(无插件)直播-jrs直播低调看直播-jrs直播nba-jrs直播 上海地磅秤|电子地上衡|防爆地磅_上海地磅秤厂家–越衡称重 | 颗粒机,颗粒机组,木屑颗粒机-济南劲能机械有限公司 | 对辊式破碎机-对辊制砂机-双辊-双齿辊破碎机-巩义市裕顺机械制造有限公司 | 厌氧反应器,IC厌氧反应器,厌氧三相分离器-山东创博环保科技有限公司 | 四合院设计_四合院装修_四合院会所设计-四合院古建设计与建造中心1 | 过跨车_过跨电瓶车_过跨转运车_横移电动平车_厂区转运车_无轨转运车 | 路面机械厂家| 北京模型公司-军事模型-工业模型制作-北京百艺模型沙盘公司 | 红酒招商加盟-葡萄酒加盟-进口红酒代理-青岛枞木酒业有限公司 | 广东护栏厂家-广州护栏网厂家-广东省安麦斯交通设施有限公司 | 北京普辉律师事务所官网_北京律师24小时免费咨询|法律咨询 | 拼装地板,悬浮地板厂家,悬浮式拼装运动地板-石家庄博超地板科技有限公司 | 贴板式电磁阀-不锈钢-气动上展式放料阀-上海弗雷西阀门有限公司 工业机械三维动画制作 环保设备原理三维演示动画 自动化装配产线三维动画制作公司-南京燃动数字 | 叉车电池-叉车电瓶-叉车蓄电池-铅酸蓄电池-电动叉车蓄电池生产厂家 | 技德应用| 鹤壁创新仪器公司-全自动量热仪,定硫仪,煤炭测硫仪,灰熔点测定仪,快速自动测氢仪,工业分析仪,煤质化验仪器 | 压砖机_电动螺旋压力机_粉末成型压力机_郑州华隆机械tel_0371-60121717 | 巨野月嫂-家政公司-巨野县红墙安康母婴护理中心 | 玉米加工设备,玉米深加工机械,玉米糁加工设备.玉米脱皮制糁机 华豫万通粮机 | 电磁流量计_智能防腐防爆管道式计量表-金湖凯铭仪表有限公司 | 合景一建-无尘车间设计施工_食品医药洁净车间工程装修总承包公司 | 户外环保不锈钢垃圾桶_标识标牌制作_园林公园椅厂家_花箱定制-北京汇众环艺 | 首页-恒温恒湿试验箱_恒温恒湿箱_高低温试验箱_高低温交变湿热试验箱_苏州正合 | 铸铁平台,大理石平台专业生产厂家_河北-北重机械 | 基本型顶空进样器-全自动热脱附解吸仪价格-AutoHS全模式-成都科林分析技术有限公司 | 基本型顶空进样器-全自动热脱附解吸仪价格-AutoHS全模式-成都科林分析技术有限公司 | 高压互感器,电流互感器,电压互感器-上海鄂互电气科技有限公司 | 蓝莓施肥机,智能施肥机,自动施肥机,水肥一体化项目,水肥一体机厂家,小型施肥机,圣大节水,滴灌施工方案,山东圣大节水科技有限公司官网17864474793 | 哈希PC1R1A,哈希CA9300,哈希SC4500-上海鑫嵩实业有限公司 | loft装修,上海嘉定酒店式公寓装修公司—曼城装饰 | 哈尔滨发电机,黑龙江柴油发电机组-北方星光 | 会议会展活动拍摄_年会庆典演出跟拍_摄影摄像直播-艾木传媒 | 东莞市超赞电子科技有限公司 全系列直插/贴片铝电解电容,电解电容,电容器 | 二手回收公司_销毁处理公司_设备回收公司-找回收信息网 | 香港新时代国际美容美发化妆美甲培训学校-26年培训经验,值得信赖! | 工装定制/做厂家/公司_工装订做/制价格/费用-北京圣达信工装 | 山东包装,山东印刷厂,济南印刷厂-济南富丽彩印刷有限公司 | 齿式联轴器-弹性联轴器-联轴器厂家-江苏诺兴传动联轴器制造有限公司 | 股指期货-期货开户-交易手续费佣金加1分-保证金低-期货公司排名靠前-万利信息开户 | 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | ET3000双钳形接地电阻测试仪_ZSR10A直流_SXJS-IV智能_SX-9000全自动油介质损耗测试仪-上海康登 |