How to: Deploy WCF RIA Service with Telerik® Data Access
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
This topic describes the steps you must perform to deploy your WCF RIA Services application to a Web server.
Confirm that the .NET Framework 4 Platform is Installed on the Web Server
The .NET Framework 4 must be installed on the Web Server for a RIA Services application to work.
Install RIA Services on the Web Server
The RIA Services assemblies must be available on the Web Server. You can make them available on the Web Server by either including them in the Bin folder of your project or by installing them in the global assembly cache (GAC).
- Bin Deployment - when deploying your application, you can include the RIA Services assemblies in the Bin folder of your project. To do this, you must select in Visual Studio each reference that you want to include and must set the Copy Local property to True. After setting this value to True, the assemblies will be copied to the Bin folder the next time you build the solution. When the assemblies are copied to the Bin folder, they will be copied to the Web server when you publish the site.
-
GAC Deployment - instead of copying the RIA Services assemblies in the Bin folder of every project that uses them, you can install the assemblies in the GAC. Any assemblies in the GAC are available to every application on the server. This approach is easier to maintain because an assembly only needs to be updated in the GAC instead of every Bin folder.
To install the RIA Services assemblies in the GAC on a Web server, run the following command.
msiexec /i RiaServices.msi SERVER=TRUE
Install Telerik Data Access on the Web Server
The Telerik Data Access assemblies must be available on the Web Server. You can make them available on the Web Server by either including them in the Bin folder of your project or by installing them in the global assembly cache (GAC). The needed assemblies are:
- Telerik.OpenAccess.dll
- Telerik.OpenAccess.35.Extensions.dll
- Telerik.OpenAccess.40.Extensions.dll
- Telerik.OpenAccess.Runtime.dll
- Telerik.OpneAccess.Ria.Extensions.dll
Check Service Configuration
To deploy a WCF RIA service on IIS, the application that hosts it has to contain the appropriate **.SVC* file. To provide such, you can use the following steps:
- Open the application in Visual Studio
-
In the ClientBin folder of the service application, add a new WCF Service:
- Right-click on ClientBin and select Add > New Item... in order to run the Add New Item... dialogue.
-
Select the WCF Service template, provide a name for the file following demonstrated convention, and click OK:
[WebApplication name]-[Name of the domain service type].svc
-
In Solution Explorer expand the ClientBin folder and delete the following files:
- I[WebApplication name]-[Name of the domain service type].cs(vb)
- [WebApplication name]-[Name of the domain service type].svc.cs(vb)
-
Edit the .SVC file with the help of the XML editor and provide content similar to the following:
<%@ServiceHost language="C#" Debug="true" Service="Fullyqualified.Service.Name" Factory="System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory" %>
<%@ServiceHost language="VB" Debug="true" Service="Fullyqualified.Service.Name" Factory="System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory" %>
Select the .SVC file and open Properties Window for it. Set the Copy to Output Directory property to Copy always.
Check Configuration Values
By default, all of these values are set in the Web.config file when you create a RIA Services solution in Visual Studio. If you deploy this Web.config file with any necessary changes to move from your development environment to the production environment, your RIA Services solution is properly configured. However, if you must retain an existing Web.config file, you will need to integrate the values for RIA Services. These values include the aspNetCompatibilityEnabled setting, the target framework, and the domain service definitions.
To set the aspNetCompatibilityEnabled property to true, include the following element in Web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
To set the target framework to 4.0, include the following element:
<compilation targetFramework="4.0" />
To define the domain service module, specify it in the <httpModules> and <modules> elements:
<system.web>
<httpModules>
<add name="DomainServiceModule"
type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule,
System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="DomainServiceModule" preCondition="managedHandler"
type="System.ServiceModel.DomainServices.Hosting.DomainServiceHttpModule,
System.ServiceModel.DomainServices.Hosting, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31BF3856AD364E35" />
</modules>
</system.webServer>
Security Issues
If you are using "Integrated Security=True" in your connection string for your "LocalSqlServer" connection (the connection to the database that your authentication service is using), then it is possible to have security issues when deploying your Silverlight application. When you are running the Silverlight application under Visual Studio 2010, the personated user is you, the current windows login user. But when you deploy the Silverlight application to IIS, unless you set a valid windows user as the user that your Application connects as, the personated user is the Network Service. In this situation there are two possible solutions:
- Add login for the "NT AUTHORITY\NETWORK SERVICE" to your server. After that give permissions for "NT AUTHORITY\NETWORK SERVICE" to the target database.
- Change the connection string to use SQL authentication instead of Windows authentication.