المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Returning an object from a web service



C# Programming
04-30-2010, 01:21 PM
Hi Folks,

I currently have an issue where I'm trying to write some code to allow me to return an object from a web service. When this object is based on a Struct, all's good. However, when I replace the Struct with a [Serializable]Class, compile, and run the service, on invoking the method which is to return the class object, I receive the below error:

==================================================================================================== ==
Server Error in '/' Application.
--------------------------------------------------------------------------------
This type of page is not served.
Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asp' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /default.asp
==================================================================================================== ==

The reason I'd like to move from using a Struct to a Class is this would allow me to take advantage of interfaces and generics, to move the code which currently populates the Struct's properties from a DbDataReader's values into a delegate function, which can take a reader and a list of each field's type, and convert each record to an instance of the Struct.

Thanks in advance.

JB