在 Windows 10 更新 1803 后,我的程序从网络共享运行时无法打开套接字

After Windows 10 update 1803 my program can#39;t open a socket when running from network share(在 Windows 10 更新 1803 后,我的程序从网络共享运行时无法打开套接字)

本文介绍了在 Windows 10 更新 1803 后,我的程序从网络共享运行时无法打开套接字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Windows 10 中的共享文件夹中运行一些自行编写的 Winforms .net 3.5 应用程序.

I am running some self written Winforms .net 3.5 applications from a shared folder in Windows 10.

一切正常,但在上次大更新 (1803) 之后,应用程序不再启动.

Everything worked correctly, but after the last big update (1803) the application doesn't start any more.

似乎程序在尝试打开套接字时崩溃了.第一个问题是访问数据库时出现以下异常:

It seems that the program is crashing in the moment it is trying to open a socket. The first problem was when accessing the database it got the following exception:

2018-05-03 14:36:32,314 [1] ERROR NHibernate.Transaction.AdoTransaction [(null)] - Begin transaction failed
MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: invalid argument
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder settings, IPAddress ip, Boolean unix)
   at MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix)
   at MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.NativeDriver.Open()

我已尝试解决此问题,但当程序从网络共享启动时,即使访问 SSH 服务器也无法正常工作:

I've tried to work around this issue, but even accessing a SSH server didn't work when the program is started from the network share:

2018-05-03 14:30:30,654 [1] ERROR WinForms.SpringApplication [(null)] - Main Handler
Tamir.SharpSsh.jsch.JSchException: System.Net.Sockets.SocketException: invalid argument
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port)
   at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeout)
   bei Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
   bei Tamir.SharpSsh.SshBase.ConnectSession(Int32 tcpPort)
   bei Tamir.SharpSsh.SshBase.Connect(Int32 tcpPort)
   bei Tamir.SharpSsh.SshBase.Connect()

当我在本地复制目录时,程序运行良好.

When I copy the directory locally the program works fine.

知道为什么当我从网络共享启动这个程序时,Windows 似乎阻止了对套接字的访问吗?

Any ideas why it seems that Windows is blocking access to sockets when I'm starting this program from a network share ?

我知道信任 .net 代码,因此它可以从网络共享运行,但我已经更新了完全信任,但它仍然崩溃(如果我没有完全信任,通常它会更早崩溃).

I know about trusting .net code, so it can be run from a network share, but I've renewed the full trust and it still crashes (and normally it crashes much earlier if I didn't do a full trust).

推荐答案

我们有一些关于这个问题的信息:

We have some information about this issue:

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)

您可以尝试将您的程序移动到与 SMBv2 或 SMBv3 兼容的服务器上进行检查.

You can try to move your program to a SMBv2 or SMBv3 compatible server to check it.

这篇关于在 Windows 10 更新 1803 后,我的程序从网络共享运行时无法打开套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 Windows 10 更新 1803 后,我的程序从网络共享运行时无法打开套接字

基础教程推荐