परिदृश्य: मैं निबर्ननेट का उपयोग करने के लिए हमारे अनुप्रयोगों में से एक को दोबारा करने की प्रक्रिया में हूं और कुछ हफ्ते पहले इस मुद्दे पर आया था। मुद्दा मूल रूप से निबर्ननेट और कैसल के साथ था और इसे हल करने के लिए उन्हें [assembly: AllowPartiallyTrustedCallers]
के साथ दोबारा बनाया गया था। हालांकि यूआई और कोडबेस में कुछ बदलाव करने के बाद यह त्रुटि फिर से दिखाई दे दी है। यह भी ध्यान देने योग्य है कि मैं फॉर्मूमेन से प्रोग्रामेटिक रूप से मेरे उपयोगकर्ता को लोड करने पर नियंत्रण को नियंत्रित करता हूं।वह असेंबली आंशिक रूप से विश्वसनीय कॉलर्स की अनुमति नहीं देती है। प्रारंभिक कॉम्पोनेंट()
समस्या: जब भी उपयोगकर्ता नियंत्रण उत्पन्न होता है तो मुझे नीचे त्रुटि मिलती है। अगर मैं लोडिंग पर टिप्पणी करता हूं तो प्रोग्राम चलाएगा। जब मैं डीबग करता हूं तो यह InitializeComponent() फ़ंक्शन पर समाप्त होता है जो स्वतः उत्पन्न होता है। ध्यान दें कि मैं उस समारोह में कदम नहीं उठा सकता।
System.Security.SecurityException was unhandled
Message="That assembly does not allow partially trusted callers."
Source="A"
GrantedSet=""
PermissionState=""
RefusedSet=""
Url="file:///C:/Documents and Settings/ID/Desktop/A-NHIB2/bin/Debug/A.EXE"
StackTrace:
at A.UserControlCyber.InitializeComponent()
at A.UserControlCyber..ctor() in C:\Documents and Settings\ID\Desktop\A-NHIB2\UserControl_Cyber.cs:line 34
at A.FormMain.FormMainLoad(Object sender, EventArgs e) in C:\Documents and Settings\ID\Desktop\A-NHIB2\Form_Main.cs:line 30
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at A.Program.Main() in C:\Documents and Settings\ID\Desktop\A-NHIB2\Program.cs:line 32
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
किसी के पास इस विषय पर कोई विचार है? मैंने पहले से ही असेंबली में [असेंबली: AllowPartiallyTrustedCallers] को जोड़ा है। क्या यह पता लगाने का कोई तरीका है कि कौन सा संदर्भ (?) इस त्रुटि का कारण बन रहा है? या InitializeComponent() के माध्यम से कदम करने के लिए किसी भी तरह से?
नोट: मेरे पास प्रत्येक अनुमति शामिल है और परियोजना आंशिक विश्वास पर सेट है।
वैसे भी किसी भी मदद की सराहना की जाती है।
सी: \ दस्तावेज़ और सेटिंग्स \ आईडी \ डेस्कटॉप, क्या यह एक वास्तविक पथ है या आपने इसे संपादित किया है? सी: ड्राइव से चलने वाले ऐप्स हमेशा पूर्ण विश्वास के साथ चलना चाहिए। Recompiling केवल असली समस्या छुपाया। –
@ हंस पासेंट, आईडी मेरा उपयोगकर्ता नाम है जिसे मैंने हटा दिया। फिलहाल मैं अपनी स्थानीय मशीन से चयनित अनुमतियों के साथ प्रोग्राम चला रहा हूं ताकि मुझे प्रत्येक बार परीक्षण करने के लिए नेटवर्क शेयर में प्रकाशन जारी रखने की आवश्यकता न हो। – Gage
मुझे लगता है कि "चयनित अनुमतियां" आपकी समस्या है। अपने प्रश्न में यह दस्तावेज नहीं करना एक बड़ी गलती है। –