为什么在ASP.NET 3.5 Web应用程序默认的“通用处理器”的代码将属性添加到类,但不正确的命名空间引用。这是他们给你的模板外的开箱:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Handler1
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class People : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("Hello World");
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

他们为什么不具有在顶部一行:

using System.Web.Services;

这是微软的默认模板中的错误?我缺少的东西吗?

有帮助吗?

解决方案

编辑:我现在看到了,当你添加一个通用处理器向一个网页的应用的(对不起,我错过了你的问题第一次)我得到了新的无功能模板。我同意你应该只修改默认模板其他用户。如果你使用MVC,你不需要再处理不过。

看起来就像是一个已知的bug,这里的MS连接的问题它的。

如果您希望编辑的模板,它位于:C:\ Program Files文件\微软的Visual Studio 9.0 \ Common7 \ IDE \的ItemTemplate \ CSHARP \网络\ 1033 \ Handler.zip

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top