Hello.
I am trying to reproduce the demo application available at
http://demos.telerik.com/aspnet-ajax/scheduler/examples/wcf/defaultcs.aspx.
Using Visual Studio 2008, I have created a web application with components RadScriptManager and RadScheduler:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication6._Default" %> <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> </div> <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> </telerik:RadScriptManager> <telerik:RadScheduler ID="RadScheduler1" runat="server"> <WebServiceSettings Path="~/App_Code/SchedulerWcfService.svc" ResourcePopulationMode="ServerSide" /> </telerik:RadScheduler> </form> </body> </html>An AJAX-enabled WCF service was added to the solution:
using System.Collections.Generic; using System.ServiceModel; using System.ServiceModel.Activation; using System.Web; using Telerik.Web.UI; [ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(IncludeExceptionDetailInFaults = true)] public class SchedulerWcfService { private WebServiceAppointmentController _controller; private WebServiceAppointmentController Controller { get { if (_controller == null) { _controller = new WebServiceAppointmentController( new XmlSchedulerProvider(HttpContext.Current.Server.MapPath("~/App_Data/Appointments_Outlook.xml"), false)); } return _controller; } } [OperationContract] public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo) { return Controller.GetAppointments(schedulerInfo); } [OperationContract] public IEnumerable<AppointmentData> InsertAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData) { return Controller.InsertAppointment(schedulerInfo, appointmentData); } [OperationContract] public IEnumerable<AppointmentData> UpdateAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData) { return Controller.UpdateAppointment(schedulerInfo, appointmentData); } [OperationContract] public IEnumerable<AppointmentData> CreateRecurrenceException(SchedulerInfo schedulerInfo, AppointmentData recurrenceExceptionData) { return Controller.CreateRecurrenceException(schedulerInfo, recurrenceExceptionData); } [OperationContract] public IEnumerable<AppointmentData> RemoveRecurrenceExceptions(SchedulerInfo schedulerInfo, AppointmentData masterAppointmentData) { return Controller.RemoveRecurrenceExceptions(schedulerInfo, masterAppointmentData); } [OperationContract] public IEnumerable<AppointmentData> DeleteAppointment(SchedulerInfo schedulerInfo, AppointmentData appointmentData, bool deleteSeries) { return Controller.DeleteAppointment(schedulerInfo, appointmentData, deleteSeries); } [OperationContract] public IEnumerable<ResourceData> GetResources(SchedulerInfo schedulerInfo) { return Controller.GetResources(schedulerInfo); } }Since data is retrieved from file Appointments_Outlook.xml, the file was copied from C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q3 2010\Live Demos\App_Data to directory App_Data of the web application.
The following section was automatically added to web.config:
<system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="WebApplication6.App_Code.SchedulerWcfServiceAspNetAjaxBehavior"> <enableWebScript /> </behavior> </endpointBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <services> <service name="WebApplication6.App_Code.SchedulerWcfService"> <endpoint address="" behaviorConfiguration="WebApplication6.App_Code.SchedulerWcfServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="WebApplication6.App_Code.SchedulerWcfService" /> </service> </services> </system.serviceModel>When I launch the application, the following error message is displayed:
Server Error in '/' Application. -------------------------------------------------------------------------------- The remote server returned an error: (403) Forbidden. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (403) Forbidden. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [WebException: The remote server returned an error: (403) Forbidden.] System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) +302 System.Net.WebClient.UploadString(Uri address, String method, String data) +170 System.Net.WebClient.UploadString(String address, String method, String data) +35 Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +471 [Exception: An error occurred while requesting resources from the web service. Server responded with: <html> <head> <title>Forbidden</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: 8pt;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: 8pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style> </head> <body bgcolor="white"> <span><h1>Server Error in '/' Application.<hr width=100% size=1 color=silver></h1> <h2> <i>HTTP Error 403 - Forbidden.</i> </h2></span> <hr width=100% size=1 color=silver> <b>Version Information:</b> ASP.NET Development Server 9.0.0.0 </font> </body> </html> ] Telerik.Web.UI.SchedulerWebServiceClient.GetResources() +633 Telerik.Web.UI.RadScheduler.BindResourcesFromWebService() +95 Telerik.Web.UI.RadScheduler.BindResources() +50 Telerik.Web.UI.RadScheduler.PerformSelect() +88 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 Telerik.Web.UI.RadScheduler.EnsureDataBound() +51 Telerik.Web.UI.RadScheduler.CreateChildControls(Boolean bindFromDataSource) +63 Telerik.Web.UI.RadScheduler.CreateChildControls() +10 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +44 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.3607; ASP.NET Version:2.0.50727.3618 I would appreciate whether you could provide some assistance to solve the problem.
Thank you in advance.
Paulo