필자는 Intellisense를 JQuery에서 Visual Studio 2008에 KB958502 패치를 적용하고이 줄을 포함하여 마침내 얻었습니다.WCF Ajax 서비스에 대한 인텔리 센스를 얻으려면 어떻게해야합니까?
/// <reference path="JQuery\jquery-1.3.2.js"/>
.js 파일 맨 위. 이제 ScriptManager의 ScriptReference 요소에 의해 생성 된 클라이언트 프록시에 대해 JavaScript 인텔리 센스를 얻는 방법을 알아 내려고합니다. ,하지만 나는 Intellisense를 얻지 못하고있다.
내 서비스는 .svc 파일로 정의됩니다.
<%@ ServiceHost Language="C#" Debug="true" Service="Documents.Services.DocLookups" CodeBehind="~/App_Code/DocLookups.cs" %>
파일 숨김 파일은 다음과 같습니다.
[ServiceContract(Namespace = "Documents.Services", Name = "DocLookups")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class DocLookups {
...
이 클래스의 샘플 메서드는 다음과 같습니다.
//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;
}
그리고 다음과 같이 정의 된 데이터 계약을 사용합니다.
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; }
}
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; }
}
내 자바 스크립트 파일에서이 서비스에 대한 호출은 다음과 같습니다.
Documents.Services.DocLookups.GetCategoriesForSelectList(...
하지만 Intellisense는 없습니다 , 내가 문서를 입력하면 아무 것도 나타나지 않습니다.) 나는 생성 된 메소드 나 메소드가 사용하는 [DataContract] 타입에 대해 인텔리 센스를 얻지 못한다.
나는 이 프록시 및 유형에 대해 Intellisense를 얻으려고했지만가 내가 잘못했을 수도있는 것을 알 수 없다고 생각합니다. TIA.
그것은 처음 작동하지 않았다, 그러나 그것은 DID는 MicrosoftAjax.js에 대한 참조로 앞서야한다는 것을 알게 된 후에 작동합니다. /// <참조 이름 = "MicrosoftAjax.js"/> /// <참조 경로 = "../ Documents/Services/DocLookups .svc "/> 도움을 주셔서 감사합니다. –
/// ..... 좋지 않을 것입니다! –
BozoJoe
VS2010에서도 MicrosoftAjax.js 참조로 서비스 파일 참조를 앞에 놓아야합니다. 어디에서나 그 사실을 발견 할 수 없었습니다! – BrianFinkel