asp.net - the server responded with a status of 500 (Internal Server Error) when calling webservice -


i not have experience web applications , when thought have working going wrong. studied demo online in c# , created own simple version seems work fine. take input , pass webservice. tried implementing similar webservice in more complex application , following error no clear indication why not work:

the server responded status of 500 (internal server error)  

this within browser debugger , not clarify why.

webservice url :hostlocal:xxxxx/svc/contact.asmx/contactmessage

my webservice code follows:

<system.web.services.webservice(namespace:="http://tempuri.org/")> _ <system.web.services.webservicebinding(conformsto:=wsiprofiles.basicprofile1_1)> _  <toolboxitem(false)> _ public class contact inherits system.web.services.webservice  <webmethod()> _ public function contactmessage(byval clientproj string, email string, message string) string       dim insert_succes integer = load_data("", clientproj, "", "", "", "", "", "", "", "", email, message, "")     dim passedvalidation boolean = true      ' here can return flag can handle on client side accordingly     ' if need      return if(passedvalidation, "1", "0")  end function 

and javascript calls it:

var dojoxhr;   require(["dojo/parser", "dojo/query", "dojo/dom-class", "dojo/dom-style",      "dojo/on", "dojo/_base/event", "dojo/request/xhr", "dijit/form/validationtextbox", "dojo/domready!"], function (parser, query, domclass, domstyle, on, event, xhr) {      parser.parse();      var btnsubmit = document.getelementbyid('btnsubmit');      function correctinput(div, td, msg) {         domstyle.set(div, 'display', '');         td.innerhtml = msg;     }      on(btnsubmit, 'click', function (e) {         event.stop(e);         var clientproj = dijit.byid("clientname").get("value");         var clientkey = dijit.byid("clientkey").get("value");         var accesstoken = dijit.byid("accesstoken").get("value");         var lusername = dijit.byid("lusername").get("value");         var lpassword = dijit.byid("lpassword").get("value");         var provid = dijit.byid("provid").get("value");             var feedback = document.getelementbyid('feedback');         var feedbacktd = query('td.feedback')[0];          domstyle.set(feedback, 'display', 'none');          if (!validateemail(lusername)) {             correctinput(feedback, feedbacktd, 'please enter valid email.');             return;         }          var port = document.location.port;         var xhrpath = '//' + document.location.hostname + (port == (80 || 443) ? '/' : ':' + port + '/') + 'svc/contact.asmx/contactmessage';          var msgbody = {             clientproj: clientproj,             clientkey: clientkey,             accesstoken: accesstoken,             lusername: lusername,             lpassword: lpassword,             provid: provid         };          xhr(xhrpath, {             headers: { "content-type": "application/json; charset=utf-8" },             method: 'post',             data: json.stringify(msgbody)         }).then(function (data) {             if (data == "0") {                 correctinput(feedback, feedbacktd, 'your message not sent.');                 return;             }             alert('bcrap still not working now!');             // show feedback user             domstyle.set(feedback, 'display', '');             domstyle.set(document.getelementbyid('msgbodyoutter'), 'display', 'none');             feedbacktd.innerhtml = "message sent successfully.";         });     }) }); 

your service exception handling trap error , write event log (or something) can see what's going on. alternatively, run in debug mode through visual studio , issue test -- should catch @ breakpoint , allow step through see problem is.


Comments