注册Windows service不成功 弹出Unhandled exception
TD-Hydro opened this issue · comments
Theodore Huang commented
错误Stack 如下
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'file:///E:\Programs\NSProxy\NSmartProxyWinService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///E:\Programs\NSProxy\NSmartProxyWinService.exe' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at System.Configuration.Install.AssemblyInstaller.set_Path(String value)
at NSmartProxyWinform.Util.WinServiceHelper.InstallService(String serviceFilePath)
at NSmartProxyWinform.ClientMngr.btnRegWinSrv_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4010.0 built by: NET48REL1LAST_B
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
NSmartProxyWinform
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///E:/Programs/NSProxy/NSmartProxyWinform.exe
----------------------------------------
log4net
Assembly Version: 2.0.8.0
Win32 Version: 2.0.8.0
CodeBase: file:///E:/Programs/NSProxy/DLLs/log4net.DLL
----------------------------------------
Microsoft.Extensions.Configuration
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.Configuration.DLL
----------------------------------------
netstandard
Assembly Version: 2.0.0.0
Win32 Version: 4.8.3752.0
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/netstandard/v4.0_2.0.0.0__cc7b13ffcd2ddd51/netstandard.dll
----------------------------------------
Microsoft.Extensions.Configuration.Abstractions
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.Configuration.Abstractions.DLL
----------------------------------------
Microsoft.Extensions.Configuration.FileExtensions
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.Configuration.FileExtensions.DLL
----------------------------------------
Microsoft.Extensions.Configuration.Json
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.Configuration.Json.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.8.4001.0 built by: NET48REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.Extensions.FileProviders.Physical
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.FileProviders.Physical.DLL
----------------------------------------
Microsoft.Extensions.FileProviders.Abstractions
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.FileProviders.Abstractions.DLL
----------------------------------------
Microsoft.Extensions.Primitives
Assembly Version: 2.2.0.0
Win32 Version: 2.2.0.18315
CodeBase: file:///E:/Programs/NSProxy/DLLs/Microsoft.Extensions.Primitives.DLL
----------------------------------------
Newtonsoft.Json
Assembly Version: 11.0.0.0
Win32 Version: 11.0.2.21924
CodeBase: file:///E:/Programs/NSProxy/DLLs/Newtonsoft.Json.DLL
----------------------------------------
System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
NSmartProxy.Infrastructure
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///E:/Programs/NSProxy/DLLs/NSmartProxy.Infrastructure.DLL
----------------------------------------
NSmartProxy.ClientRouter
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///E:/Programs/NSProxy/DLLs/NSmartProxy.ClientRouter.DLL
----------------------------------------
NSmartProxy.Data
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///E:/Programs/NSProxy/DLLs/NSmartProxy.Data.DLL
----------------------------------------
System.Runtime.Serialization
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3825.0 built by: NET48REL1LAST_B
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.ServiceProcess
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.ServiceProcess/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll
----------------------------------------
System.Net.Http
Assembly Version: 4.2.0.0
Win32 Version: 4.6.26011.01
CodeBase: file:///E:/Programs/NSProxy/DLLs/System.Net.Http.DLL
----------------------------------------
System.ValueTuple
Assembly Version: 4.0.2.0
Win32 Version: 4.6.26011.01
CodeBase: file:///E:/Programs/NSProxy/DLLs/System.ValueTuple.DLL
----------------------------------------
System.Configuration.Install
Assembly Version: 4.0.0.0
Win32 Version: 4.8.3752.0 built by: NET48REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration.Install/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.Install.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
TMOONLIGHT commented
是否以管理员身份运行了?
Theodore Huang commented
是用管理员身份运行的
TMOONLIGHT commented
该问题在最新版本里尝试修复了下,但是因为我这里没复现出来,问题发生的原因不明。有空的话请协助验证下,谢谢。