我一直在試圖從一個wcf服務獲取數據並進入fullcalendar控件。但是,我沒有運氣,想知道我做錯了什麼。FullCalendar和WCF
的JScript:
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
editable: false,
height: 200,
aspectRatio: 100,
events: "http://localhost:63295/_services/Service2.svc/DoWork/"
等等
WCF接口:
[ServiceContract]
public interface IService2
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
string[] DoWork();
}
WCF服務:
public string[] DoWork()
{
// Add your operation implementation here
SortedDictionary<string, string> d = new SortedDictionary<string, string>();
NameValueCollection AE = new NameValueCollection();
SqlDataReader sdr = ReadData("SelectALLAE");
while (sdr.Read())
{
AE.Add("title", sdr["AE_EmployeeID"].ToString() + " " + sdr["AE_EmployeeName"].ToString() + " " + sdr["AE_EventCode"].ToString());
AE.Add("start", sdr["AE_StartDateTime"].ToString());
AE.Add("end", sdr["AE_EndDateTime"].ToString());
}
return AE.GetValues(0).ToArray();
}
Web.config文件:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="CountryProvinceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="CountryProvinceBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="CountryProvinceBehavior" name="TimesheetsV2._0_Investigations._services.Service2">
<endpoint address="" binding="webHttpBinding" contract="TimesheetsV2._0_Investigations._services.IService2" behaviorConfiguration="CountryProvinceBehavior"/>
</service>
</services>
</system.serviceModel>
我已經在沒有完整日曆的頁面上成功連接到此wcf。這是我可以測試如何通過jQuery連接到wcf服務。
但是,當我使用fullcalendar事件選項,沒有任何反應。它甚至沒有連接wcf服務(我試圖對服務進行調試,但什麼也沒有發生)。
任何幫助,將不勝感激
感謝
如果您發佈的代碼或XML(如web.config文件),** **請在高亮文本編輯器的線和編輯器工具欄上的漂亮格式點擊「代碼」按鈕(101 010)並語法突出顯示它! – 2010-09-08 16:52:01