0
我試圖使用RDP客戶端來運行我的.NET應用程序,該應用程序駐留在來自我們域的網絡共享中。.NET應用程序無法從網絡共享和RDP Shell運行
當啓動一個「全」 RDP會話(即打開整個桌面),然後從的.exe文件運行我的應用程序,一切工作正常。
但是,當我設置此相同.EXE作爲Startup Application Path
從RDP客戶端,我得到以下錯誤:
(PS:我修剪的堆棧跟蹤,我發現自己更重要的調用)
System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Environment' threw an exception. ---> System.ArgumentException: Incorrect Parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
(...)
at System.AppDomain.get_Evidence()
(...)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at NHibernate.Cfg.Environment.LoadGlobalPropertiesFromAppConfig() in p:\nhibernate-core\src\NHibernate\Cfg\Environment.cs:line 212
at NHibernate.Cfg.Environment..cctor() in p:\nhibernate-core\src\NHibernate\Cfg\Environment.cs:line 198
當我和影像複製文件的工作,我設置一個新的AppDomain當應用程序剛剛開始(.exe文件入口點):
<STAThread()>
Public Sub Main()
Try
Dim currentDirectory As DirectoryInfo = New DirectoryInfo(Directory.GetCurrentDirectory)
Dim runtimeDirectory As DirectoryInfo = New FileInfo(Assembly.GetExecutingAssembly.Location).Directory
Dim appDomainStartupSetup As New AppDomainSetup
appDomainStartupSetup.ApplicationBase = currentDirectory.FullName
appDomainStartupSetup.ShadowCopyFiles = "true"
Dim appDomainStartup As AppDomain = AppDomain.CreateDomain("StartupAppDomain", Nothing, appDomainStartupSetup)
Dim entrypointLoader As LoadBaseFiles = appDomainStartup.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly.CodeBase, "MyClass.LoadBaseFiles")
entrypointLoader.RuntimeDir = runtimeDirectory.FullName ' Setup the 'entry-point' object
entrypointLoader.StartupEntryPoint() ' Starts the Application
Catch ex As Exception
' Error Handling Here
End Try
End Sub
Public Class LoadBaseFiles
Inherits MarshalByRefObject
' Startup stuff here...
End Class
更多信息
- Content of my ApplicationEntryPoint.exe.config file;
- 我已成立了CAS策略全機信任,但我不知道這仍然適用於.NET 4.0;
- 遠程桌面(終端服務)服務器運行Windows Server 2003;
編輯:
- 如果我所有的組件複製到本地驅動器(C:)和運行從那裏我的應用程序,它會正常工作。
任何建議?
在我的app.config中沒有nhibernate節 - 我的所有NHibernate的東西都是以編程方式完成的。我在上面的鏈接中發佈的App.Config內容是'它的確是'。問題是爲什麼'System.Configuration.ConfigurationManager.GetSection(String sectionName)'調用(和子調用)結束拋出這個'Exception'。 – 2013-05-09 21:17:54
對不起,我其實完全沒有閱讀過RDP。更新了我的答案。 – EKW 2013-05-09 21:45:14