I am pulling my hair out over this one.
I have a WCF interface for calls on a web server. All the other functions are working fine, but the new function I added is resulting in “The remote server returned an error: NotFound.” in the Reference.cs auto generated file in the End function.
I know the server is found, I have the debugger breaking on the service side and its clearly being called and returning the correct type.
What else could cause this misleading error?
[ServiceContract]
public interface IDatabaseQueries
{
...
[OperationContract(AsyncPattern = true)]
IAsyncResult BeginGetItemFromId(int itemID, AsyncCallback callback, Object state);
RmaItem EndGetItemFromId(IAsyncResult result);
...
}
[DataContract]
[KnownType(typeof(ItemType))]
[KnownType(typeof(Location))]
[KnownType(typeof(DateTime))]
public class RmaItem
{
...
}
[SilverlightFaultBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[KnownType(typeof(RmaItem))]
[KnownType(typeof(RmaReport))]
public class DatabaseService : IDatabaseQueries
{
...
public IAsyncResult BeginGetItemFromId(int itemID, AsyncCallback callback, Object state)
{
return new DatabaseResponse(itemID);
}
public RmaItem EndGetItemFromId(IAsyncResult result)
{
return GetRmaItemById((int)(result as DatabaseResponse).GetData);
}
...
}
Crashing in “Reference.cs”:
public RMA.DatabaseServiceReference.RmaItem EndGetItemFromId(System.IAsyncResult result) {
object[] _args = new object[0];
RMA.DatabaseServiceReference.RmaItem _result = ((RMA.DatabaseServiceReference.RmaItem)(base.EndInvoke("GetItemFromId", _args, result)));
return _result;
Edit:
When I say all other functions I mean additional functions is the same IDatabaseQueries interface.
EDIT 2::
Turns out the problem was using a Enum as a field (ItemType). As shown above, I have ItemType as a known type. Is there a special condition I am missing on that type? Here is the deceleration.
[DataContract]
public enum ItemType
{
LOCATION, PART, ASSEMBLY
}
Resolved.
I was missing the EnumMember with each value in the ItemType enumaration.
Thank you for the response McAden