Wcf服务调用中出现问题 [英] problem in Calling Wcf Service

查看:140
本文介绍了Wcf服务调用中出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了Wcf Service,并且此输出类似

[{{id:" AD," name:" Andorra},{" id:" AE," name:"阿拉伯联合酋长国},{" id:" AF,"名称:"阿富汗},{" id:" AG,"名称:"安提瓜和巴布达},{" id:" AI,"名称:"安圭拉},{" id: "AL",名称":阿尔巴尼亚"},{"id":"AM",名称":亚美尼亚"},{"id":"AN",名称":荷属安的列斯"}, {"id":"AO",名称":安哥拉"},{"id":"AQ",名称":"Antartica"},{"id":"AR",名称":阿根廷},{" id:" AS,"名称:"萨摩亚,美国},{" id:" AT,"名称:"奥地利},{" id:" AU","name":"Australia"},{"id":"AW","name":"Aruba"},{"id":"AX","name":奥兰群岛"},{"id :" AZ,"名称:"阿塞拜疆},{" id:" BA,"名称:"波斯尼亚黑塞哥维那},{" id:" BB,"名称:"巴巴多斯"},{"id":"BD",名称":孟加拉"},{"id":"BE",名称":比利时"},{"id":"BF",名称" :布基纳法索"}]


但是当我用javascript调用它时

I created Wcf Service and this output like this

[{"id":"AD","name":"Andorra"},{"id":"AE","name":"United Arab Emirates"},{"id":"AF","name":"Afghanistan"},{"id":"AG","name":"Antigua And Barbuda"},{"id":"AI","name":"Anguilla"},{"id":"AL","name":"Albania"},{"id":"AM","name":"Armenia"},{"id":"AN","name":"Netherland Antilles"},{"id":"AO","name":"Angola"},{"id":"AQ","name":"Antartica"},{"id":"AR","name":"Argentina"},{"id":"AS","name":"Samoa, American"},{"id":"AT","name":"Austria"},{"id":"AU","name":"Australia"},{"id":"AW","name":"Aruba"},{"id":"AX","name":"Aland Islands"},{"id":"AZ","name":"Azerbaijan"},{"id":"BA","name":"Bosnia Herzegovina"},{"id":"BB","name":"Barbados"},{"id":"BD","name":"Bangladesh"},{"id":"BE","name":"Belgium"},{"id":"BF","name":"Burkina Faso"}]


but when i Call it in javascript

<div>
       <input type="text" id="demo-input" name="blah" />
       <input type="button" value="Submit" />
       <script type="text/javascript">
       $(document).ready(function() {
           $("#demo-input").tokenInput("http://localhost:4398/MyFirstService.svc/json/getdata");
       });
       </script>
   </div>



输入项目中没有数据

:本地链接已删除



there is no data in input item

: localhost link removed

推荐答案

(document).ready(function(){
(document).ready(function() {


(#demo-input").tokenInput("http://localhost:4398/MyFirstService.svc/json/getdata"); }); < /script > < /div >
("#demo-input").tokenInput("http://localhost:4398/MyFirstService.svc/json/getdata"); }); </script> </div>



输入项目中没有数据

:本地链接已删除



there is no data in input item

: localhost link removed


从代码中看来,调用TokenInput插件时似乎未命中Web服务.在方法中放置一个断点只是为了验证服务是否被命中.

另外,请查看浏览器是否关闭了JavaScript调试功能,否则如果绑定插件存在一些问题,它将引发一些错误.如果在此绑定之前包含了插件,则可能是该插件的位置未正确映射到虚拟目录结构.使用ResoloveUrl处理这种情况(如果存在).

在浏览器中启用javascript调试后,如果报告了某些错误,请提供错误详细信息,以帮助找出原因.
From the code, it seems that the webservice is not getting hit when calling the TokenInput pluggin. Place a breakpoint within the method just to validate if the service is being hit.

Also, see if JavaScript debugging is turned off in the browser, as else it will throw some error if there''s some issue binding the pluggin. If the pluggin is included before this binding, it can be that the pluggin''s location is not correctly mapped to the virtual directory structure. Use ResoloveUrl to handle this case, if present.

If there are some errors reported after enabling the javascript debugging in the browser, please include the error details so as to help find out the cause.


这篇关于Wcf服务调用中出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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