Hi,
I'm trying to call a simple "Hello World" method in a .NET web service from a script in my Unity project.
On running the Unity application in the editor, it makes it to the point of calling service.HelloWorld() and then I receive the following error:
*WebException: There was an error on processing web request: Status code 500(InternalServerError): Internal Server Error
System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd ()*
The **script code** is as follows:
using UnityEngine;
using System;
using System.ServiceModel;
using System.Collections;
public class clsWebServiceTest : MonoBehaviour
{
// Use this for initialization
void Start ()
{
MyWebServiceSoapClient service = new MyWebServiceSoapClient(new BasicHttpBinding(),
new EndpointAddress("http://localhost:57937/MyWebService.asmx"));
service.Open();
Debug.Log ("State: " + service.State);
Debug.Log ("Endpoint: " + service.Endpoint);
Debug.Log ("Type: " + service.GetType());
Debug.Log ("Inner Channel: " + service.InnerChannel);
string hello = service.HelloWorld();
Debug.Log(hello);
service.Close();
}
}
This is my **web service code**:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' _ _ _ _
Public Class MyWebService
Inherits System.Web.Services.WebService _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
And finally, the **web.config** for the service
↧