I have an OData WCF service in my ASP.NET project that i use to read and update an SQL-Server database.
For one of the tables, the primary key is a DateTime field. When try开发者_StackOverflow中文版ing to access specific rows through the OData service, the uri looks like this: "http://server/odataservice/stats(datetime'2009-12-12T00:00:00')".
When trying to update this table through the service, or browsing to it, it gives only an error. The error is sent before the WCF service is ever contacted, and as far as i've been able to find it's because the IIS does not allow colons in uri's, only in queries, for security reasons (something about NTFS).
The actual IIS error is "HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid", but it seems a bit misleading.
If i remove the colons and browse to "http://server/odataservice/stats(datetime'2009-12-12')" it works as expected. However i'm clueless as how i'm supposed to be able to do this in by C# client that is bound to the OData service. It also feels very hacky to edit the uri on the client or on the server on the fly, i would rather have a proper solution.
I'm using a hosted IIS, so i cannot as far as i know change it's configuration to allow colons, even if that was possible.
If you've got control of the OData service application, then this may be helpful (found via the .NET Framework section at www.odata.org/developers/articles)
精彩评论