Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Unusual problem - possibly permissions
MrTall
#1 Posted : Tuesday, May 30, 2006 11:58:23 PM(UTC)
Groups: Member
Joined: 5/30/2006(UTC)
Posts: 2
Location: UK

I've come across a very odd problem that I can't get my head around. I've written a web service that uses some third party dlls to query a SQL 2000 server (the ddls are for SIMS by Capita if this helps anyone, but have no access to the code so I'm not quite sure how this is done).

The code runs fine under IIS, runs fine under a Cassini application I've written, but errors under a Cassini service I wrote. The service I wrote was very basic and quickly written so I thought I'd try under are more developed version so I tried UltiDev and the error persists. This is under the .NET 2.0 version.

The error I am getting is:

System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

I can supply the rest of the error message if required.

I've tried running the service under a user account rather than the system account with no joy. The problem is unlikely to be on the SQL server as the error is just a default error and it works under Cassini running as an application.

Just to add an extra little twist, the some of the calls access COM objects and others .NET dlls. The COM object calls work fine, it is just the .NET dll calls that error.

If anyone could shed some light onto this I'd be very grateful, I've been tearing my hair out for the last few days.

Cheers

Chris
Ultidev Team
#2 Posted : Wednesday, May 31, 2006 11:21:52 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Hello, Chris.

We don't have an answer for this, but we can suggest trying changing Cassini service's identity from default "Local System" account to your interactive user's account and see if that makes any difference. Also, if your business objects are this sensitive to security context, consider using .NET Enterprise Services/COM+ to wrap them into some definitive conext where they are known to be working - to avoid uncertainity added by web server's account privileges.

Regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
MrTall
#3 Posted : Thursday, June 1, 2006 5:28:09 AM(UTC)
Groups: Member
Joined: 5/30/2006(UTC)
Posts: 2
Location: UK

I think I've worked out what is going on. The SQL connection string is read from a text file which is located in the same folder as the UltiDev exe.

The current folder for a .NET dll when running Cassini as a program is the folder where the exe is located, when running as a service it is c:\windows\system32.

The current folder for a COM when running Cassini is always the folder where the exe is located, regardless of whether it is running as a service or a program.

As a result the .NET dlls are searching for the connection string file in the wrong location and when they do not find it are defaulting to localhost (this was spotted using TCPMon from SysInternals). As there was not a SQL server on localhost the SQL exception was being raised.

Thanks for you help

Cheers

Chris
Ultidev Team
#4 Posted : Thursday, June 1, 2006 7:46:59 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Great! We're glad you've figured it out.

Regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (5)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.