Monday, 15 August 2011

c# - Web Service in MVC app -



c# - Web Service in MVC app -

i have big problem web service included in mvc app. i've made mvc app , it's hosting on iis 7.0. works perfect. must add together web service (of course of study wcf, ws allready exists) project. in visual studio 2010, added new item, choosed web service current project. on dev machine, it's ok. everyting wokrs fine. when seek publish whole project iis (it's on server), mvc app don't see ws.

that's how phone call ws, in mvc :

$('#test').click(function test2() { alert('start'); $.ajax({ type: "post", url: "/../webserviceprzeczytany.asmx/helloworld", data: "{}", datatype: "xml", success: function suc(msg) { alert("recieved: " + msg.text); }, faild: fail }); alert('stop'); }); function fail() { alert("doesn't work"); };

it's jquery, see. question : why doesn't work ? should set or configure on iis ?

i'll grateful help or clues.

marcin

you doing approach violation cross-domain policy calling or executing client-side calls webservice via javascript. there existing approach if want execute or phone call service via ajax using jsonp provided meet next conditions:

*you have command on webservice code namely can modify code , customize jsonp

*you wrap webservice response jsonp callback.

for more info see http://api.jquery.com/jquery.ajax/

without jsonp it's working locally if in live environment that's not gonna work.

c# asp.net-mvc web-services

No comments:

Post a Comment