Hi I have: * a very simple ADO.Net Data Service which indirectly exposes a single table (for now) in a MSSQL 2008 db. The records are (ordered) urls to images used by an silverlight header i've knocked together which fades between the specified images. * a silverlight 3 client, the header, making a rest call to get a list of entities matching the table records. This works fine locally, the request goes out and returns with a list of urls, which are then consumed by the header but when deployed to DASP, instead of sending a HTTP GET request against the rest-style url, silverlight (via the host browser) is issuing an HTTP OPTIONS request which is then getting a '501 Not Implemented' response. >> Does anyone have any idea what might be triggering this change in behaviour? Any hint as to what's happening would be *really* appreciated. This has taken most of the day and I'm no closer to a solution than when I started :-( Thanks... Lee. PS. There are a few more details below... 1) Here's one of the broken requests, grabbed using fiddler: -- OPTIONS /socialWebServices/SocialCircle.svc/HeaderImages()?$orderby=order HTTP/1.1 Host: perroh.co.uk User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Origin: http://www.perroh.co.uk Access-Control-Request-Method: GET Access-Control-Request-Headers: dataserviceversion,maxdataserviceversion -- 1a) and the matching response: -- HTTP/1.1 501 Not Implemented Cache-Control: private Content-Type: application/xml Server: Microsoft-IIS/7.0 DataServiceVersion: 1.0; X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Thu, 30 Jul 2009 15:19:11 GMT Connection: close Content-Length: 222 <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code></code> <message xml:lang="en-US">Not Implemented</message> </error> -- 2) Here's a working (localhost) request: -- GET /webServices/SocialCircle.svc/HeaderImages()?$orderby=order HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729) Accept: application/atom+xml,application/xml Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive DataServiceVersion: 1.0;Silverlight MaxDataServiceVersion: 1.0;Silverlight Referer: http://localhost/webServices/agAdminTestPage.aspx Cookie: ASPSESSIONIDSATBTSRB=ILKFDBEAGMMFAJAGOOMMDLAJ; ASPSESSIONIDCAQSQBSQ=INMBEKCDLGAGMLAGPGLJBLGK; ASPSESSIONIDCACDQQBA=MMNJAGLBDMLBLNCHHEKJKPCB; ASPSESSIONIDASQRBAAR=OPMFKNGCOCGPIABDDHKMCJPO; ASPSESSIONIDSSSTSRBQ=HKJBCPMCFPEKDOJJIOLFPOFP; ASPSESSIONIDQSSTSQAR=IKCNEKNCOCLOGICIOALCDICK; ASPSESSIONIDAABARQQS=NGMJALHDGIFMIKENMGNPBIMN; ASPSESSIONIDACDAQRRS=DBEPDFCABIDNNOLNKKJLEEJA; ASPSESSIONIDCAAAQQQT=OMJJHNCAIHCNNFAANIGLJHBO; ASPSESSIONIDAAADRRQT=CLBBCBDAFCFMEKHLCFNDCHMK; ASPSESSIONIDCADBRRQS=LMJFEHDABMNKHEMFNPLPIPKD -- 2a) and the matching response: -- HTTP/1.1 200 OK Cache-Control: no-cache Content-Type: application/atom+xml;charset=iso-8859-1 Server: Microsoft-IIS/7.5 DataServiceVersion: 1.0; X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET Date: Thu, 30 Jul 2009 16:07:09 GMT Content-Length: 3456 <?xml version="1.0" encoding="iso-8859-1" standalone="yes"?> <feed xml:base="http://localhost/WebServices/SocialCircle.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title type="text">HeaderImages</title> <id>http://localhost/webServices/SocialCircle.svc/HeaderImages</id> <updated>2009-07-30T16:07:08Z</updated> <link rel="self" title="HeaderImages" href="HeaderImages" /> <entry> <id>http://localhost/WebServices/SocialCircle.svc/HeaderImages(111)</id> <title type="text"></title> <updated>2009-07-30T16:07:08Z</updated> <author> <name /> </author> <link rel="edit" title="HeaderImages" href="HeaderImages(111)" /> <category term="SocialCircleDataModel.HeaderImages" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <mroperties> <dath>/images/uploadedHeaderImages/wheelImage960.300.png</dath> <drder m:type="Edm.Int32">0</drder> <d:caption m:null="true" /> <d:id m:type="Edm.Int32">111</d:id> </mroperties> </content> </entry> <entry> <id>http://localhost/WebServices/SocialCircle.svc/HeaderImages(110)</id> <title type="text"></title> <updated>2009-07-30T16:07:08Z</updated> <author> <name /> </author> <link rel="edit" title="HeaderImages" href="HeaderImages(110)" /> <category term="SocialCircleDataModel.HeaderImages" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <mroperties> <dath>/images/uploadedHeaderImages/mealImage960.300.png</dath> <drder m:type="Edm.Int32">1</drder> <d:caption m:null="true" /> <d:id m:type="Edm.Int32">110</d:id> </mroperties> </content> </entry> <entry> <id>http://localhost/WebServices/SocialCircle.svc/HeaderImages(113)</id> <title type="text"></title> <updated>2009-07-30T16:07:08Z</updated> <author> <name /> </author> <link rel="edit" title="HeaderImages" href="HeaderImages(113)" /> <category term="SocialCircleDataModel.HeaderImages" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <mroperties> <dath>/images/uploadedHeaderImages/gmexImage960.300.png</dath> <drder m:type="Edm.Int32">2</drder> <d:caption m:null="true" /> <d:id m:type="Edm.Int32">113</d:id> </mroperties> </content> </entry> <entry> <id>http://localhost/WebServices/SocialCircle.svc/HeaderImages(112)</id> <title type="text"></title> <updated>2009-07-30T16:07:08Z</updated> <author> <name /> </author> <link rel="edit" title="HeaderImages" href="HeaderImages(112)" /> <category term="SocialCircleDataModel.HeaderImages" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <mroperties> <dath>/images/uploadedHeaderImages/drinksImage960.300.png</dath> <drder m:type="Edm.Int32">3</drder> <d:caption m:null="true" /> <d:id m:type="Edm.Int32">112</d:id> </mropertie s> </content> </entry> </feed>-- 3) I noticed that when adding the service reference (within the silverlight project) to the ADO.Net Data Service, the service.edmx file that's auto-generated has some issues. Specifically, the edmxataServices node has two invalid Scheme children. Their xmlns was: * http://schemas.microsoft.com/ado/2007/05/edm rather than the * http://schemas.microsoft.com/ado/2006/04/edm which appears to be expected. Changing it until the warnings disappear (which involves removing the m:IsDefaultEntityContainer from the EntityContainer grandchild) doesn't seem to fix the problem but it may be relevant. 4) It's possible, using a browser, to hit the endpoint and get what looks like a sensible response. It returns the single collection of entities which are exposed as well as correct-looking metadata when using the '$metadata' suffix. So, whatever the problem, it appears to be related to the method the silverlight client is relating to the service. At a wild guess, maybe the silverlight ADO.Net DS client is trying to get metadata from the service but for some reason is using HTTP OPTIONS rather than the expected $metadata suffix ? 5) I have these declarations within the web.config of the project hosting the ADO.Net DS: -- for DASP -- <configuration> ... ..lots more content.. ... <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"> <baseAddressPrefixFilters> <add prefix="http://perroh.co.uk/socialWebServices"/> </baseAddressPrefixFilters> </serviceHostingEnvironment> <services> <service name="SocialCircleService"> <endpoint address="http://perroh.co.uk/socialWebServices/socialcircle.svc" binding="webHttpBinding" bindingConfiguration="higherMessageSize" contract="System.Data.Services.IRequestHandler" /> </service> </services> <bindings> <webHttpBinding> <binding name="higherMessageSize" maxReceivedMessageSize="5000000"/> </webHttpBinding> </bindings> </system.serviceModel> </configuration> -- for DASP (end) -- -- for localhost -- <configuration> ... ..lots more content.. ... <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel> </configuration> -- for localhost (end) -- 6) I'm testing locally using the debug version but on DASP using the precompiled version of the site.
Hi, Well, you appear to have a handle on this. I've got everything I need to help you with this but just went over that 3 times and can't come up with anything you have done wrong. I'll keep checking however, if I come up with anything I'll re-post. Sorry about that... Mark
No, I really don't. I can't imagine what to try next. I really need this to work. I changed to discountAsp from godaddy because of similar problems now I can't get it to work here, either. It kind of makes it pointless to have a local development server because it behaves entirely differently when deployed Starting to wonder how to move forward now...
...Tell me what you want to test, what you expect for results and I'll try to create it on an IIS7 DASP server from scratch. I'm old school in this respect, find it easier at times to start from scratch. ;-) All the best, Mark
Ok, thanks You'll need a database containing a single table with a string column 'url' and an integer column 'order'. in visual studio, create a 'data' probject and add to it an entity model wrapped around the database, mapping the table. create another project 'service' and add to it an ado.net data service around the entity model. create a silverlight3 project and website. to the silverlight project, add a service reference to the service. within the silverlight project build a linq query and execute it asynchronously: Code: var q = (from image in Context.HeaderImages orderby image.order ascending select image ) as DataServiceQuery<HeaderImages>; try { List<HeaderImages> knownFiles = new List<HeaderImages>(); q.BeginExecute( (ar) => { Dispatcher.BeginInvoke(() => { foreach (HeaderImages image in q.EndExecute(ar)) { knownFiles.Add(file); } }); }, null ); } catch (Exception ex) { // do something with ex } For me, this works locally but as I said in the first post, issues an HTTP OPTIONS response when hosted on DASP and fails with a 501 :-( The worst thing is not knowing *why* this is happening... So, if all goes well, you'll see the request go out as an HTTP GET and actual records will be returned. It's strange that it works from the browser but not from silverlight.. Good luck. Thanks again for this.
OK..Wait a sec... Have you tried this with Blend 3? Would it help if I create a SQL Server Silverlight 3 data project with Blend 3? (I'm primarily using Expression Studio 3 for these things for now.) All the best, Mark
I may be mistaken but I believe you can only follow the steps I've described using visual studio 2008 sp1 or later. I think blend3 supports opening of all a solution's files but doesn't have the wizards for the initial creation. I could supply you with a test solution which contains the features I described in the earlier post, if you like (as you've been so kind as to help
...Blend 3 changed much of that, it's a new beast with some awesome data features: http://www.microsoft.com/expression/products/Blend_Features.aspx I really don't want to "mess" with my VS2008 config right now and would rather not do any Silverlight in it. (Long story but getting it to work properly on Vista Ultimate was a nightmare.) All the best, Mark
Vista!? Seriously, download the RC or RTM of Windows 7, it's faaaaar more stable. Anyhow, thanks for your help so far. Probably time to revert to asmx web services and a DAL as ADO.Net Data Services seem to be something only useable for those with their own server. Lee.
...Indeed. Two Intel machines here, Vista Ultimate and Home Premium, everything runs better on Home Premium...everything. Waiting for Win7 release to MSDN next week, even going to upgrade an old XP sys. ;-) Sorry about not being able to help with this, I honestly do my best. Cheers, Mark