sharepoint事件接收器从不触发

sharepoint事件接收器从不触发,sharepoint,Sharepoint,我尝试了以下几个关于如何创建sharepoint事件接收器的示例。大多数示例的说明都相当简单。所以我能够在VisualStudio2010中创建一个sharepoint事件接收器项目(例如:添加项或删除站点),并部署到服务器和站点。我检查了功能,它被激活了。我运行了一些测试,比如删除一个测试站点,甚至上传一个文件。但是我在代码中输入的测试错误消息从未运行过。我不明白为什么这些事件从未被触发 以下是我的代码示例: using System; using System.Security.Permis

我尝试了以下几个关于如何创建sharepoint事件接收器的示例。大多数示例的说明都相当简单。所以我能够在VisualStudio2010中创建一个sharepoint事件接收器项目(例如:添加项或删除站点),并部署到服务器和站点。我检查了功能,它被激活了。我运行了一些测试,比如删除一个测试站点,甚至上传一个文件。但是我在代码中输入的测试错误消息从未运行过。我不明白为什么这些事件从未被触发

以下是我的代码示例:

using System;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.Workflow;

namespace DeletingSite.EventReceiver1
{
    /// <summary>
    /// Web Events
    /// </summary>
    public class EventReceiver1 : SPWebEventReceiver
    {
       /// <summary>
       /// A site is being deleted.
       /// </summary>
       public override void WebDeleting(SPWebEventProperties properties)
       {
           base.WebDeleting(properties);
           properties.Cancel = true;
           properties.ErrorMessage = "You cannot ";
       }
    }
}
使用系统;
使用System.Security.Permissions;
使用Microsoft.SharePoint;
使用Microsoft.SharePoint.Security;
使用Microsoft.SharePoint.Utilities;
使用Microsoft.SharePoint.Workflow;
命名空间DeletingSite.EventReceiver1
{
/// 
///网络事件
/// 
公共类EventReceiver 1:SPWebEventReceiver
{
/// 
///正在删除一个站点。
/// 
public override void WebDeleting(SPWebEventProperties属性)
{
base.WebDeleting(属性);
properties.Cancel=true;
properties.ErrorMessage=“您不能”;
}
}
}

在事件接收器项下,将有element.xml文件。此文件定义事件接收器的连接方式和位置。请检查该文件中的所有内容是否正确。

EventReceive1WebDeleteing WebDeleteing$SharePoint.Project.AssemblyFullName$DeletetingSite.EventReceive1.EventReceive1 10000对于elements.xml的外观,我深表歉意。无论如何,我在GAC中看到了事件接收器的dll。不确定这意味着什么:$SharePoint.Project.AssemblyFullName$$SharePoint.Project.AssemblyFullName$是一个占位符,在以完整程序集名称发布时被VS替换。