Why do I get this error in a WebServices project?
I have a ClickOnce app that accesses a bunch of web services. On the client, I have one project that wraps all the web services.
In the Properties for that projec开发者_Go百科t, if Build/Generate Serialization Assembly is Auto (which is the default), then everything works fine. I set the option to On, it compiles fine, then during runtime I get this error:
Line 786: [WebMethod]
Line 787: public CC.DTO.AdvertiserAssignmentRevenueDTO[] SearchAdvertiserAssignmentRevenue(byte[] AdvAssgnRevenueSearchFilter)
Line 788: {
Line 789: try
The Detailed Compiler Output is basically "CS0234: The type or namespace name 'DTO' does not exist in the namespace 'CC' (are you missing an assembly reference?)"
Why is this happening? Just FYI, this is a .NET 2.0 project running in VS2008.
I had a very similar error message with the same symptoms. For me it would even run locally but not on a different server. It turned out I was missing a data contract declaration on one of my methods.
[DataContract (Namespace = ...)]
Double check your methods on the service and client to ensure they have all the needed attributes and declarations.
精彩评论