wcf-data-services

Configure wcf service programmatically

試著忘記壹切 提交于 2019-12-28 07:05:09
问题 I have a remote wcf service, I connect it by WSHttpBinding. If I use the empty service constructor which mean it will take all the configurations from the app.config , everything is ok, (I mean MyService s = new MyService()). Now I want to configure the wcf programmatically . it's simple till I arrive to the authentication issue , it was so hard to do that . Here is the app.config which I use , you can see there my security configurations . <system.serviceModel> <bindings> <wsHttpBinding>

WCF Data Services Expand as Linq Statement

别来无恙 提交于 2019-12-25 18:16:48
问题 at the moment I am trying myself with WCF Data Services. Now I am trying to query my Servie for some objects similar to the EF ( which is my datasource of the Service ) with an Include Statement, to get an objecttree. My statement looks like this at this moment : var query = this.Entities.Veranstaltung.Expand( "VeranstaltungMaterial/Material/Template" ).Expand( "Ort,Dozent" ); var k = query.Where( z => z.DauerTage > 5 && z.TemplateID == null ); Is it possible to write the Expandstatement via

WCF & JSON: Serialize long as string

不问归期 提交于 2019-12-25 11:59:11
问题 I have a wcf data service and a normal rest wcf service. Both services return the same entity object. [DataContract] public partial class MyEntity { #region Primitive Properties [DataMember] public virtual long ID { get; set; } .... The normal rest wcf service uses the following service contract: [ServiceContract] public interface MyService { [OperationContract] [WebGet(UriTemplate="MyEntity/{id}",ResponseFormat=WebMessageFormat.Json)] public MyEntity GetMyEntity(string id) } while the wcf

Self-hosted WCF Data service authentication

时光怂恿深爱的人放手 提交于 2019-12-25 07:26:46
问题 I have self-hosted WCF Data service set up in similar way to this - http://blogs.msdn.com/b/writingdata_services/archive/2011/01/24/self-hosting-a-wcf-data-service.aspx How does one add Windows authentication on top of this? I know how to add it in IIS however self-hosted scenario is escaping me... Thanks in advance! 回答1: The trick is to use app.config and configure all the security settings there...: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings>

WCF Data Services join query

时间秒杀一切 提交于 2019-12-25 06:57:19
问题 I want to retrieve the results of this query (Northwind Database): var ent = new Entities(); var query = from c in ent.Customers join o in ent.Orders on c.CustomerID equals o.CustomerID join od in ent.Order_Details on o.OrderID equals od.OrderID join p in ent.Products on od.ProductID equals p.ProductID where p.ProductName == "Chai" select c; by using WCF Data Services. I type this (which doesn't work): http://localhost:29792/WcfDataService1.svc/Customers?$select=CompanyName&$expand=Orders

Query interceptors: Change response status code

岁酱吖の 提交于 2019-12-25 05:31:47
问题 Is it possible to change the HTTP status code returned by WCF Data Services when one of the query interceptors return false? As a bonus, is there a way to selectively return different status codes depending on the query interceptor that failed? 回答1: Could you use something like the following to access the current service method and change the returned HTTP method header information WebOperationContext operationContext = new WebOperationContext(OperationContext.Current); operationContext

How to increase the MaxStringContentLength size when creating the XML reader

折月煮酒 提交于 2019-12-25 05:14:38
问题 I am getting following error: The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'InsertQuery'. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 33788. To increase the size of MaxStringContentLength, i

WCF Service throws Http404 on any request except .svc

天涯浪子 提交于 2019-12-25 04:33:19
问题 I have created a WCF Service Library in MVC project and set up MySerice.svc and Web.Config file in project as follow: <!--added to run WCF service --> <system.serviceModel> <!-- this multipleSiteBindingsEnabled for remote access --> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="True" /> <services> <service name="SchoolProject.WCF.SchoolProjectService" behaviorConfiguration="ServiceBehaviour"> <endpoint address="" binding="webHttpBinding" contract=

DataServiceVersion conflict: The DataServiceVersion '1.0' is too low for the request. The lowest supported version is '3.0'

落爺英雄遲暮 提交于 2019-12-25 01:45:31
问题 Using this technique ( How to dynamic add filters to a LINQ query against an Odata Source in C# ) I dynamically build up a where clause in a LINQ query to my Odata endpoint. I do this often and it works great. However now my query contains some odata v3.0 features and i'm getting this error. The DataServiceVersion '1.0' is too low for the request. The lowest supported version is '3.0' I've build a simple reproduction using the only northwind endpoint at , and can reproduce it in standard C#

How do I expose related data through a WCF Data Service?

空扰寡人 提交于 2019-12-24 19:26:14
问题 I have been reading through Alex D. James three year old blog posts as found here: http://blogs.msdn.com/b/alexj/archive/2010/02/24/creating-a-data-service-provider-part-8-relationships.aspx It is a wonderful blog series about exposing custom data through WCF Data Services. In the 8th post titled "Relationships" he talks about how to describe and expose related data. The problem with the post as pointed out by the one commenter is that he does it in memory, but does not explain how to