Options

Navision acess problem through Web Service

liquid_dreamliquid_dream Member Posts: 8
Hi

I've built a solution that connects to an ODBC data source.
The data source is from a native Navision 4.0 database.
I've been able to do this through a Windows Application project.

The problem starts when i try to do the same through an ASP .NET Web Service.
When i invoke the method that connects to the data source Internet Explorer
tries to load the page and continues to load and load and load.
If I stop and run the project again an error appears:
"Server Application Unavailable
The web application you are attempting to access on this web server is
currently unavailable. Please hit the "Refresh" button in your web browser
to retry your request.

Administrator Note: An error message detailing the cause of this specific
request failure can be found in the application event log of the web server.
Please review this log entry to discover what caused this error to occur. "

The error that appears in Event Viewer is
"aspnet_wp.exe (PID: 2024) stopped unexpectedly."
The Event ID is 1000.

If i try using an ODBC that connects to an Access database the Webservice
works fine, so believe it must be something about the time the Navision Data
source takes to open (Using Windows Aplication takes about 20 seconds).


The code is this
[WebMethod]
public string getName(){
string connstring = "DSN=navision";

OdbcConnection conn = null;
OdbcCommand cmd =null;
string val = null;
string query = "select N§,\"Alias Nome\" from Cliente where \"Alias
Nome\" like 'GDE%'";

OdbcDataReader read = null;

try
{
conn = new OdbcConnection(connstring);
conn.Open();
cmd = new OdbcCommand(query,conn);
read =cmd.ExecuteReader();




while(read.Read())
{
val="ID: " + read.GetString(0);
val= val + " Name: " + read.GetString(1) + "<->";


}
return val;
conn.Close();

}
catch(Exception ex)
{
conn.Close();
return ex.Message;


}
}


After using breakpoints i detected that the Web Service hangs on conn.Open().



Can someone shine some light?

I wonder if anyone has had this problem.
Thanks
Sign In or Register to comment.