After Windows 10 update 1803 my program can't

2019-01-14 19:19发布

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

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

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.

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

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

3条回答
手持菜刀,她持情操
2楼-- · 2019-01-14 19:42

I test this - if server allow SMBv1 only (max) any connection can't be create from executables from shared. If SMB is v2, all works fine.

查看更多
地球回转人心会变
3楼-- · 2019-01-14 19:48

We have some information about this issue:

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

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

查看更多
▲ chillily
4楼-- · 2019-01-14 19:56

Microsoft fixed this on June 26, 2018 in the 2018-06 Cumulative Update for Windows 10 Version 1803 for x64-based Systems (KB4284848) (OS Build 17134.137).

One of the fixes is relevant:

Addresses an issue where some users may receive an error when accessing files or running programs from a shared folder using the SMBv1 protocol. The error is "An invalid argument was supplied".

This and other workarounds are discussed in:

https://blog.mertech.com/windows-10-version-1803-breaks-some-shared-folder-applications

查看更多
登录 后发表回答