easyTree
07-30-2009, 08:53 AM
Hi :D
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">
<m:properties>
<d:path>/images/uploadedHeaderImages/wheelImage960.300.png</d:path>
<d:order m:type="Edm.Int32">0</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">111</d:id>
</m:properties>
</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">
<m:properties>
<d:path>/images/uploadedHeaderImages/mealImage960.300.png</d:path>
<d:order m:type="Edm.Int32">1</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">110</d:id>
</m:properties>
</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">
<m:properties>
<d:path>/images/uploadedHeaderImages/gmexImage960.300.png</d:path>
<d:order m:type="Edm.Int32">2</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">113</d:id>
</m:properties>
</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">
<m:properties>
<d:path>/images/uploadedHeaderImages/drinksImage960.300.png</d:path>
<d:order m:type="Edm.Int32">3</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">112</d:id>
</m:propertie
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 edmx:DataServices 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.
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">
<m:properties>
<d:path>/images/uploadedHeaderImages/wheelImage960.300.png</d:path>
<d:order m:type="Edm.Int32">0</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">111</d:id>
</m:properties>
</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">
<m:properties>
<d:path>/images/uploadedHeaderImages/mealImage960.300.png</d:path>
<d:order m:type="Edm.Int32">1</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">110</d:id>
</m:properties>
</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">
<m:properties>
<d:path>/images/uploadedHeaderImages/gmexImage960.300.png</d:path>
<d:order m:type="Edm.Int32">2</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">113</d:id>
</m:properties>
</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">
<m:properties>
<d:path>/images/uploadedHeaderImages/drinksImage960.300.png</d:path>
<d:order m:type="Edm.Int32">3</d:order>
<d:caption m:null="true" />
<d:id m:type="Edm.Int32">112</d:id>
</m:propertie
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 edmx:DataServices 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.