- Install the following two updates:
- Add a reference to "Microsoft.ServiceModel.DomainServices.Hosting" to your web application project
- Add the following to your web.config into the
tag <domainServices> <endpoints> <add name="OData" type="System.ServiceModel.DomainServices.Hosting.ODataEndpointFactory, System.ServiceModel.DomainServices.Hosting.OData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add name="Soap" type="Microsoft.ServiceModel.DomainServices.Hosting.SoapXmlEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> <add name="Json" type="Microsoft.ServiceModel.DomainServices.Hosting.JsonEndpointFactory, Microsoft.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> endpoints> domainServices>
- Here the first pitfall arised; the application did not compile anymore complaining:
The "CreateRiaClientFilesTask" task failed unexpectedly.
Unrecognized configuration section system.serviceModel/domainServices.
To resolve this add the following to thetag: <sectionGroup name="system.serviceModel"> <section name="domainServices" type="System.ServiceModel.DomainServices.Hosting.DomainServicesSection, System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowDefinition="MachineToApplication" requirePermission="false" /> sectionGroup>
- According to some howtos the URL is composed as follows:
http://localhost:[port]/[Name of Silverlight Project]-Web-[Name of Webservice]/Json/[Method name]
e.g.: http://localhost:2002/MySilverlightApp-Web-DataAccessService/Json/GetArticles - The above URL always returned 404 Not found
- My next pitfall was that my service class file was not in the web project but in a subfolder ("Services") of it
- To solve that I had to modify the URL as follows:
http://localhost:[port]/[Name of Silverlight Project]-Web-[Folder name]-[Name of Webservice]/Json/[Method name]
e.g.: http://localhost:2002/MySilverlightApp-Web-Services-DataAccessService/Json/GetArticles - After that I finally got my JSON from my webservice :-)
Wednesday, April 11, 2012
WCF RIA Services with JSON endpoint
Today I had the task to add a JSON endpoint for a WCF RIA service for which there exists a Silverlight client.
I wanted to state some problems that I encountered such that maybe others can get it to work faster:
Monday, March 12, 2012
Entity Framework no columns when mapping stored procedure
Recently I had the problem that I wanted to map a stored procedure with the Entity Framework. As soon as I clicked on "Get column information" no columns showed up despite I knew that the stored procedure returns a table with some columns.
After some research I found out that in some circumstances it is necessary to add the following two statements at the beginning of the stored procedure:
After that everything worked as expected.
After some research I found out that in some circumstances it is necessary to add the following two statements at the beginning of the stored procedure:
SET NOCOUNT OFF; SET FMTONLY OFF;
After that everything worked as expected.
Subscribe to:
Posts (Atom)