Error processing web request: Status code 500

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.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class MyWebService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String
       Return "Hello World"
    End Function

End Class

And finally, the web.config for the service

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
</configuration>

Did you find solution for this? I am facing same, please help if its working for you now. In local its working for me, once hosted to server its not.