1
votes

I'm new to Azure and I'm doing a small test:

I have a SQL Azure database and I use EF6.

I also have a cloud service which connects to the Azure database (a "Windows Azure Cloud Service" with 1 web role).

My service has 2 methods:

  1. GetString(): returns a string.
  2. GetUsers(): return users from table [User] in my Azure database (returns IEnumerable<User>)

When I call GetString() it works fine.

when I call GetUsers() I get the following error:

The underlying connection was closed: The connection was closed unexpectedly.

I've also tried using the WCF Test Client and get the same error.

When I create a console app which connects to my SQL Azure (with the same connection string), everything works fine and I get a list of my users from the database.

The problem only happens when connecting to the database from within the Azure service.

My SQL Azure is configured to allow WINDOWS AZURE SERVICES.

Any ideas?

Thanks!

** UPDATE **

When I use the service locally I get the following error while calling GetUsers:

An error occurred while receiving the HTTP response to localhost:50119/MyService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

1
A couple of thoughts... 1). Check the event log on the VM instance to see if there's anything useful there. 2). Turn on WCF Tracing (msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx) so you can get a detailed trace of what's happening.Rick Rainey
Using Service Trace Viewer i see this error: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.kruvi

1 Answers

1
votes

I figured this out:

Behaviors, Bindings and Services was not configured in my web.config file. I thoughts it should be configured by default and probably i was mistaken.

Thanks!