如何获得智能感知WCF阿贾克斯服务? [英] How do I get intellisense for WCF Ajax Services?

查看:160
本文介绍了如何获得智能感知WCF阿贾克斯服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于得到了智能感知工作的jQuery应用补丁KB958502到Visual Studio 2008和包括该行:

I've finally got Intellisense working for JQuery by applying patch KB958502 to Visual Studio 2008 and including this line:

/// <reference path="JQuery\jquery-1.3.2.js"/>

在我的.js文件的顶部。现在,我试图找出如何让JavaScript的智能感知通过ScriptManager的的ScriptReference元素生成的客户端代理(如下所示):

at the top of my .js files. Now I'm trying to figure out how to get JavaScript intellisense for the client proxies generated by the ScriptManager's ScriptReference elements (as shown here):

    <asp:ScriptManager ID="ScriptManager1" runat="Server" EnablePartialRendering="false" AsyncPostBackTimeout="999999">
        <Services>
            <asp:ServiceReference path="../Services/DocLookups.svc" />
        </Services>
    </asp:ScriptManager>

客户端代理工作 - 即我可以通过他们拨打电话,但我没有得到智能感知

The client proxies are working -- i.e. I can make calls through them, but I'm getting no Intellisense.

我的服务被定义了.svc文件:

My service is defined with a .svc file:

<%@ ServiceHost Language="C#" Debug="true" Service="Documents.Services.DocLookups" CodeBehind="~/App_Code/DocLookups.cs" %>

隐藏文件中的code是这样的:

The code behind file looks like:

[ServiceContract(Namespace = "Documents.Services", Name = "DocLookups")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class DocLookups {
...

在这个类样本的方法是:

a sample method in this class is:

    //Called at the begining of the page to fill in the category list
    [OperationContract]
    public SelectOption[] GetCategoriesForSelectList()
    {
        SelectOption[] Result;
        IDocumentRepository repository = new DocumentEntityRepository(ConnectionString);
        Result = (from cat in repository.GetDocCategories()
                  select new SelectOption(cat.Category_ID.ToString(), cat.CategoryName)).ToArray();
        if (Result.Length > 0)
            Result[0].Selected = true;  //Select first item 
        return Result;
    }

和它使用这样定义的数据合同:

and it uses a data contract defined like this:

namespace Documents.Services {

[DataContract]
public class SelectOption
{
    //A useful DTO to use when filling a <select> element with options
    public SelectOption(string optionValue, string optionText) {
        OptionValue = optionValue;
        OptionText = optionText;
        Selected = false;
    }
    public SelectOption(string optionValue, string optionText, bool selected) {
        OptionValue = optionValue;
        OptionText = optionText;
        Selected = selected;
    }

    [DataMember]
    public string OptionValue { get; set; }
    [DataMember]
    public string OptionText { get; set; }
    [DataMember]
    public bool Selected { get; set; }
}

}

在我的JavaScript文件,调用这个服务是这样的:

In my javascript files, a call to this service looks like:

Documents.Services.DocLookups.GetCategoriesForSelectList(...

但我没有得到任何的智能感知(例如,如果我输入文件。没有弹出)。我没有得到智能感知无论是生成的方法或[DataContract]所用的方法类型。

but I get no Intellisense (for example, if I type Documents. nothing pops up). I don't get intellisense for either the generated methods or the [DataContract] types used by the methods.

我相信我的应该即可获得智能感知为这些代理和类型,但不能找出我可能是做错了。 TIA。

I believe that I am supposed to get Intellisense for these proxies and types, but can't figure out what I might be doing wrong. TIA.

推荐答案

难道 ///&lt;参考路径=../服务/ DocLookups.svc/&GT; 不工作?

这篇关于如何获得智能感知WCF阿贾克斯服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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