SqlConnection exception thrown by WPF but not by WebSite?

78 views Asked by At

I have this project, which consists of a WCF Library acting as a Server for a Trouble Ticket system.

Link for solution skeleton: https://i.stack.imgur.com/ccz7J.jpg

I have an interface that allows me to access the server methods.

I have a DB as you can see in the picture, called "MainDB".

I have a website with a service reference to the server which works perfectly fine.

Then I needed to create a GUI application client that accesses the same server interface. I did this by creating a WPF application. I reference the server, just the same as I did in the website and use the same interface, and I call the exact same method, in this case the Login method, which you can check in this image: https://i.stack.imgur.com/fcYAE.jpg

But when I call this method from the WPF I get an exception on the red squared line which says this:

"An unhandled exception of type 'System.NullReferenceException' occurred in TTService.dll

Additional information: Object reference not set to an instance of an object."

I thought it might be because of the DB not being "published", but it was. I run the website and the WPF at the same time and one runs perfectly smooth while the other causes that exception. I can't get what's causing this, probably because I'm still not experienced in this technology. The fact that the origin of the method call is different doesn't seem to me like a plausible cause because I can't understand how the method would know where the call originated.

I'm sorry I can't put the images in the post but not enough reputation yet.

Thank you for any help.

1

There are 1 answers

0
rafrochen On BEST ANSWER

I fixed this. It actually was the Interface implementation that was wrong. Sorry for the misinformation.