Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在简单sharepoint项目中调用ashx处理程序时出错_C#_Sharepoint_Ashx - Fatal编程技术网

C# 在简单sharepoint项目中调用ashx处理程序时出错

C# 在简单sharepoint项目中调用ashx处理程序时出错,c#,sharepoint,ashx,C#,Sharepoint,Ashx,我在浏览web/\u layouts/handler/ahandler.ashx时遇到这个错误 An error occurred during the processing of /_layouts/handler/ahandler.ashx. Could not create type 'BabyClubDemo.Layouts.Handler.AHandler'. 这是我的ashx页面 <%@ WebHandler Language="C#" CodeBehind="AHandl

我在浏览web/\u layouts/handler/ahandler.ashx时遇到这个错误

 An error occurred during the processing of /_layouts/handler/ahandler.ashx. Could not create type 'BabyClubDemo.Layouts.Handler.AHandler'.
这是我的ashx页面

<%@ WebHandler Language="C#" CodeBehind="AHandler.ashx.cs" Class="BabyClubDemo.Layouts.Handler.AHandler" %>

这是我的ashx.cs

using System;
using System.Web;

namespace BabyClubDemo.Layouts.Handler
{
public class AHandler : IHttpHandler
{
    /// <summary>
    /// You will need to configure this handler in the web.config file of your 
    /// web and register it with IIS before being able to use it. For more information
    /// see the following link: http://go.microsoft.com/?linkid=8101007
    /// </summary>
    #region IHttpHandler Members

    public bool IsReusable
    {
        // Return false in case your Managed Handler cannot be reused for another request.
        // Usually this would be false in case you have some state information preserved per request.
        get { return false; }
    }

    public void ProcessRequest(HttpContext context)
    {
        context.Response.Clear();
        context.Response.ContentType = "application/json; charset=utf-8";
        context.Response.Write(CallServerFunction(context));
    }

    private string CallServerFunction(HttpContext context)
    {

        return "testing the applicaiton";
    }

    #endregion
}
使用系统;
使用System.Web;
命名空间BabyClubDemo.Layouts.Handler
{
公共类AHandler:IHttpHandler
{
/// 
///您需要在服务器的web.config文件中配置此处理程序
///在能够使用它之前,请访问web并向IIS注册。有关详细信息,请参阅
///请参阅以下链接:http://go.microsoft.com/?linkid=8101007
/// 
#区域IHttpHandler成员
公共布尔可重用
{
//如果无法将托管处理程序重新用于其他请求,则返回false。
//通常,如果每个请求都保留了一些状态信息,那么这将是错误的。
获取{return false;}
}
公共void ProcessRequest(HttpContext上下文)
{
context.Response.Clear();
context.Response.ContentType=“application/json;charset=utf-8”;
context.Response.Write(CallServerFunction(context));
}
私有字符串CallServerFunction(HttpContext上下文)
{
返回“测试应用程序”;
}
#端区
}
}


可能的问题是什么?我的.net framework是3.5。

我非常确定您将需要使用程序集的完全限定名,而不是只使用
Class=BabyClubDemo.Layouts.Handler.AHandler


SharePoint Stackexchange上发布了一个非常类似的响应:

我非常确定您将需要使用程序集的完全限定名,而不是仅使用
Class=BabyClubDemo.Layouts.Handler.AHandler


SharePoint Stackexchange上发布了一个非常类似的响应:

默认情况下,不会处理ASHX文件以替换令牌,您可以更改此行为

更改此行为的步骤:

  • 卸载项目,编辑.csproj文件并将以下文本添加到PropertyGroup,然后重新加载项目
  • 二,。
    
    处理程序
    

  • 更多详细信息可在此处找到:

  • 来源:

    默认情况下,不会处理ASHX文件以替换令牌,您可以更改此行为

    更改此行为的步骤:

  • 卸载项目,编辑.csproj文件并将以下文本添加到PropertyGroup,然后重新加载项目
  • 二,。
    
    处理程序
    

  • 更多详细信息可在此处找到:

  • 来源:

    我把它改成了这个,但仍然得到了错误。同样的错误?如何部署处理程序?你的DLL在GAC中注册了吗?我把它改成了这一个,但仍然得到了错误。同样的错误?如何部署处理程序?您的DLL是否已在GAC中注册?