I'm writing a webservice, but despite simplifying the app as much as i can, it always returns Internal Server Error.
I know the problem must be either in the asmx...
Or the error could be in the ajax call...Code:Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Web.Script.Services ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. <System.Web.Script.Services.ScriptService()> <System.Web.Services.WebService(Namespace:="http://www.scProject.biz")> <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> <ToolboxItem(False)> Public Class ASP_triQuiz_Service3 Inherits System.Web.Services.WebService Dim game As Hangman_Game <WebMethod()> Public Function CreateNewGame() As String game = New Hangman_Game Dim thread As New Threading.Thread(AddressOf DoWork, 20971520) thread.IsBackground = True thread.Start() thread.Join() While Not game.gameReady ' do nothing Threading.Thread.SpinWait(100) End While Return getArrayString(game.gameGridValues) End Function <WebMethod()> Public Function SayHi() As String Return "hi!" End Function Private Sub DoWork() 'Stop While Not game.created ' do nothing Threading.Thread.SpinWait(100) End While game.createNew2() End Sub Private Function getArrayString(GridValues()() As String) As String Dim returnString As String = "" For y As Integer = 0 To 24 returnString &= String.Join(",", GridValues(y)) & Environment.NewLine Next Return returnString.TrimEnd(CChar(vbCr), CChar(vbLf)) End Function End Class
Can anyone spot the error?Code:function newGame( ){ alert('newGame()'); // Validating input $.ajax({ type: 'POST', url: 'http://www.scProject.biz/ASP_triQuiz_Service3.asmx/CreateNewGame', data: '{}', dataType: 'text', success: function( response ) { alert('success ' + response); }, error: function( e ) { alert('error calling service ' + e.statusText); } }); }




Reply With Quote