I have a first projet "MyProject.Core", I have the EDMX with :
The repo class :
class MyProjectRepo : IMyProjects
{
public int NumberOfUser()
{
return new context().User.Count();
}
public string HelloWorld()
{
return "Hello World!";
}
}
The interface :
public interface IMyProjects
{
int NumberOfUser();
string HelloWorld();
}
The factory :
public static class MyProjectFactory
{
private static IMyProjects _returnedObject;
public static IMyProjects GetObject()
{
lock (typeof(MyProjectFactory))
{
_returnedObject = new MyProjectRepo();
}
return _returnedObject;
}
}
A test project ""MyProject.Core.Tests" (tests passed) :
[Test]
public void NumberOfUser_Test()
{
var number = MyProjectFactory.GetObject().NumberOfUser();
Assert.AreEqual(1, number);
}
[Test]
public void HelloWorld_Test()
{
var hello = MyProjectFactory.GetObject().HelloWorld();
Assert.AreEqual("Hello World!", hello);
}
I created a "Cloud" project and a WCFServiceWebRole.
In the WCFServiceWebRole, I have this :
public class Service1 : IService1
{
public int NumberOfUser()
{
return MyProjectFactory.GetObject().NumberOfUser();
}
public string Hello()
{
return MyProjectFactory.GetObject().HelloWorld();
}
}
[ServiceContract]
public interface IService1
{
[OperationContract]
int NumberOfUser(string login, string password);
[OperationContract]
string Hello();
}
A project to test the WCF, the methode "Hello" return the right value. It's with the other method I have thr problem. In the app.config, I have this :
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myproject.azurewebsites.net/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
contract="myprojectServiceAzure.IService1" name="BasicHttpBinding_IService1" />
</client>
Error :
System.TimeoutException : The request channel timed out while waiting for a reply after 00:00:59.7138476. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. ----> System.TimeoutException : The HTTP request to 'http://MyProject.azurewebsites.net/Service1.svc' has exceeded the allotted timeout of 00:00:59.9270000. The time allotted to this operation may have been a portion of a longer timeout. ----> System.Net.WebException : The operation has timed out MyProject.Azure.Tests\Service References\MyProjectServiceAzure\Reference.cs(487, 0) : MyProject.Azure.Tests.PointageServiceAzure.Service1Client.MyMethod(String login, String password) MyProject.Azure.Tests\AzureTests.cs(18, 0) : MyProject.Azure.Tests.AzureTests.Test()