This is a strange one and I’ve been trying and searching for a solution for days now.
I have created a simple webservice that queries a local MYSQL database and returns the result for the client. When I use it on a browser it works flawlessly. I created a c# script using wsdl to consume this service inside Unity 3D. The first time I run the game in the Editor it works fine but the second time I try to run it the Editor freezes for the timeout period and then it returns a WebException: Request timed out exception.
I tried creating the wsdl file using mono 4, mono 2 and .NET 4. I tried using the .cs file and creating a dll with dmcs. I tried disposing the proxy class after using it, I try invoking it inside a using block.
At this time I asked a colleague of mine to try the code and in her computer it works every time! I tried on my laptop (windows 10) and had the same result as in my desktop (also windows 10). My colleague was using Windows 8.1, so I booted my desktop with windows 8.1 and reinstalled every relevant software (wamp, VS2015, Unity3D and VSTools) also without any luck. I tried rebuild the source in Visual studio, clean solution, erase Unity 3D cache. I tried a remote server instead using wamp for the mysql database. I also hosted the webservice online instead of locally with IIS 10 express.
For the webservice I created and empty web application in VS2015, then added the data structures I needed and installed MySQL Connector to query the database. For the Unity3D project I used the wsdl proxy class as mentioned before. .NET comparability is set to 2.0 (no subset). Systems.Web and Systems.Web.Services are located in the Plugins folder in the project.
I have no more ideas of what I can do to make this work. Any suggestion would be appreciated. The strangest thing to me is that this thing works on my colleague computer! I can’t understand why! We use the same antivirus, firewall, OS, VS version, Unity3d version, MySQL Connector, mono, everything!
EDIT: complete exception:
WebException: The request timed out
System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
System.Net.HttpWebRequest.GetResponse ()
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse (System.Net.WebRequest request)