2
我正在尝试将Ajax Auto Complete Extender用于Web项目中托管的WCF服务。该服务已达到,并且我已验证结果是与小提琴手一起返回的,但与自动完成扩展程序关联的文本框从未填充过。未填充自动填充扩展程序
服务合同如下:
[ScriptService]
[ServiceContract(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public interface ICertificateService
{
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json)]
List<string> GetCompletionList(string prefixText, int count);
}
的实现只是返回字符串的填充的列表。
的ASPX如下:
<asp:TextBox runat="server" ID="aceInstructors"></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender runat="server"
ID="autoCompleteInstructor"
TargetControlID="aceInstructors"
ServiceMethod="GetCompletionList"
ServicePath="../../CertificateService"
MinimumPrefixLength="1"
CompletionInterval="1000"
EnableCaching="true" CompletionSetCount="5">
<Animations>
<OnShow> <HideAction Visible="true" /> </OnShow>
<OnHide> <HideAction Visible="false" /> </OnHide>
</Animations>
在Global.asax中被如下配置的服务的路由:
private void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("CertificateService", new WebServiceHostFactory(), typeof(CertificateService)));
}
如上所述之前,我可以热的服务当我看着小提琴手时,我收到了JSON格式的回复。以下是原始响应:
HTTP/1.1 200 OK
Server: Cassini/4.0.1.7
Date: Mon, 12 Sep 2011 16:44:16 GMT
X-AspNet-Version: 4.0.30319
Content-Length: 68
Cache-Control: private
Content-Type: application/json; charset=utf-8
Connection: Close
{"GetCompletionListResult":["Alpha","Beta","Gamma","Delta","Omega"]}
东西可能值得一提的是,如果我忽略从服务合同ResponseFormat,该reult以XML格式返回和文本框中,填入一个很长的名单undefined
我是否缺少一些基本的东西?