NullReferenceException from wcf service [closed]
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this questionI have a wcf service which I use Miquels Castro's technique, instead of user the service reference create by VS.NET 2010.
Everything worked gre开发者_如何学运维at until I added a new method. When I added the new method I got a error message:
A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in mscorlib.dll
Additional information: Object reference not set to an instance of an object.
Then
An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in Unknown Module.
Additional information: Type 'System.ServiceModel.ExceptionDetail' in Assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
The code hits the proxy class:
public DataTable GetResearchSellingTitles(string network, string year,
string quarter)
{
return Channel.GetResearchSellingTitles(network, year, quarter);
}
I have added the method to the interface and implemented it. Any ideas how to determine the root of the issue?
Update I solved the issue. It had nothing to do with th WCF service setup. What is weird is where I had where the null reference error, it was surrounded by a try catch. I also had a log util that log the error. I am not sure why it just didn't catch the error, log it and return a empty datatable. Thanks for all the suggestions.
精彩评论