In this walkthrough I’ll show you how to use the AppFabric-enabled WCF Data Service (C#) template for Visual Studio 2010 to enhance your WCF Data Services by providing
Requirements
We have added TODO tasks in the template to guide you through tasks you need to do to make your service ready
// This method is called only once to initialize service-wide policies. public static void InitializeService(DataServiceConfiguration config) { // Enable read only access to all entities config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; RouteTable.Routes.Add( new ServiceRoute("AdventureWorks", new DataServiceHostFactory(), typeof(AdventureWorks))); }
</connectionStrings> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <diagnostics etwProviderId="830b12d1-bb5b-4887-aa3f-ab508fd4c8ba"> <endToEndTracing propagateActivity="true" messageFlowTracing="true" /> </diagnostics> <behaviors> <serviceBehaviors> <behavior name=""> <etwTracking profileName="EndToEndMonitoring Tracking Profile" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <remove name="UrlRoutingModule"/> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> </modules> <handlers> <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </handlers> </system.webServer> </configuration>
To see the events in Windows Server AppFabric you need to deploy the Web project to IIS or modify your project to host the solution in the local IIS Server. For this example I’m going to modify the project to host with the local IIS server. Note: This requires you to run Visual Studio as Administrator
USE [AdventureWorksLT] GO CREATE USER [IIS USERS] FOR LOGIN [BUILTIN\IIS_IUSRS] GO USE [AdventureWorksLT] GO EXEC sp_addrolemember N'db_datareader', N'IIS USERS' GO