在Assembly - Throw Exception中使用MSMQ和System.Web模块 [英] Using MSMQ and System.Web modules in Assembly - Throw Exception

查看:64
本文介绍了在Assembly - Throw Exception中使用MSMQ和System.Web模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的程序集安装在机器的全局程序集缓存中。当调用程序集的函数时,应用程序正在崩溃,异常如​​下所示

My assembly is installed in Global Assembly Cache of the machine. When calling a function of the assembly the application is getting crashed with the exception as below



在分析崩溃时,我开始注释掉这些行,发现使用System.Web和System.Messaging中的类会导致此异常。因此,不使用像System.Web.HttpContext和System.Messaging.MessageQueue这样的类,程序集正常加载

On analyzing the crash , I started commenting out the lines and found that using classes in System.Web and System.Messaging cause this exception. So without using the classes like System.Web.HttpContext and System.Messaging.MessageQueue the assembly is getting loaded normally.


发生此问题仅在Sharepoint计算机中,并且仅当在应用程序的Web配置文件中将legacycasmodel设置为true时。我对这个问题感到震惊了很多天但是dint得到了任何线索。

This issue is occuring only in the Sharepoint machine and only when the legacycasmodel is set true in the application's web config file. I am knocking my head against this issues for so many days but dint get any clue for this.


我能理解这是由于某些权限使用这些模块,但如何使我的程序集使用这些模块(System.Web.dll / System.Messaging.dll)。我尝试将Permission集设置为完全信任等等。但没有任何效果。我在搜索
时没有将legacycasmodel设置为false。

I can understand it is due to some permissions to use those modules, but how to make my assembly to use those modules(System.Web.dll / System.Messaging.dll). I tried setting Permission sets to full trust and much more. But nothing worked. I am badly searching for a solution without making the legacycasmodel to false.


我怀疑dll是否必须拥有x509v3Certificate作为发布者证据.. ?如果是这样,我的dll没有那个..如何将证书作为发布者证据添加到dll.???/p>

I am doubting if the dll must possess x509v3Certificate as Publisher evidence..? If so my dll does not have that.. how to add the certificate as publisher evidence to the dll.??

推荐答案

您好,

我通过创建SharePoint场解决方案在我的本地服务器场中进行了示例测试,在共享时不会收到错误。




<%@ Assembly Name="


SharePoint.Project.AssemblyFullName
SharePoint.Project.AssemblyFullName


" %GT;
<%@ Import Namespace =" Microsoft.SharePoint.ApplicationPages" %GT;
<%@ Register Tagprefix =" SharePoint"命名空间= QUOT; Microsoft.SharePoint.WebControls" Assembly =" Microsoft.SharePoint,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c" %GT;
<%@ Register Tagprefix =" Utilities"命名空间= QUOT; Microsoft.SharePoint.Utilities" Assembly =" Microsoft.SharePoint,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c" %GT;
<%@ Register Tagprefix =" asp"命名空间= QUOT; System.Web.UI程序" Assembly =" System.Web.Extensions,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35" %GT;
<%@ Import Namespace =" Microsoft.SharePoint" %GT;
<%@ Assembly Name =" Microsoft.Web.CommandUI,Version = 15.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c" %GT;
<%@ Page Language =" C#" AutoEventWireup = QUOT;真"代码隐藏= QUOT; MSMQ.aspx.cs"继承= QUOT; TestMSMQInSP.Layouts.TestMSMQInSP.MSMQ" DynamicMasterPageFile = QUOT;〜masterurl / default.master" %GT;

< asp:Content ID =" PageHead" ContentPlaceHolderID = QUOT; PlaceHolderAdditionalPageHead" RUNAT = QUOT;服务器">

< / asp:Content>

< asp:Content ID =" Main" ContentPlaceHolderID = QUOT; PlaceHolderMain" RUNAT = QUOT;服务器">
< asp:Button runat =" server" ID = QUOT; btn_SendMessage"的OnClick = QUOT; btn_SendMessage_Click"文本= QUOT;按钮和QUOT; />
< / asp:Content>

< asp:Content ID =" PageTitle" ContentPlaceHolderID = QUOT; PlaceHolderPageTitle" RUNAT = QUOT;服务器">
申请页面
< / asp:内容>

< asp:Content ID =" PageTitleInTitleArea" ContentPlaceHolderID = QUOT; PlaceHolderPageTitleInTitleArea" RUNAT = QUOT;服务器" >
我的申请页面
< / asp:内容>
" %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MSMQ.aspx.cs" Inherits="TestMSMQInSP.Layouts.TestMSMQInSP.MSMQ" DynamicMasterPageFile="~masterurl/default.master" %> <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server"> </asp:Content> <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server"> <asp:Button runat="server" ID="btn_SendMessage" OnClick="btn_SendMessage_Click" Text="Button" /> </asp:Content> <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server"> Application Page </asp:Content> <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" > My Application Page </asp:Content>





using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Messaging;

namespace TestMSMQInSP.Layouts.TestMSMQInSP
{
    public class Person
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }

    }
    public partial class MSMQ : LayoutsPageBase
    {
        const string queueName = @".\private


这篇关于在Assembly - Throw Exception中使用MSMQ和System.Web模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆