2012-04-03 6 views
4

GUI 확장 프로그램에서 작동하도록 데이터 모델을 만들려고합니다. 문자열을 반환하는 간단한 서비스를 만들었습니다. 나는 model.config을 구성하고 내 Web.config의에 다음 항목을 추가 한 모델에서 웹 서비스를 생성하는 중 오류가 발생했습니다.

<services> 
    <service name="CMSExtensions.Model.Services.PublicationInfo" behaviorConfiguration="Tridion.Web.UI.ContentManager.WebServices.DeveloperBehavior"> 
     <endpoint name="PublicationInfo" address="" behaviorConfiguration="Tridion.Web.UI.ContentManager.WebServices.AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="Tridion.Web.UI.ContentManager.WebServices.WebHttpBindingConfig" contract="CMSExtensions.Model.Services.PublicationInfo"/> 
    </service>  
</services> 

나는 다음과 같은 오류 얻을 브라우저에서 직접이 서비스를 실행하려고

:

파서 오류 메시지 :이 'Tridion.Web.UI.ContentManager.WebServices.DeveloperBehavior'이라는 서비스 동작이 없습니다.

와 내가 GUI에서 JS를 통해 호출 할 때이 오류를 얻을 : 나는 SDL Tridion 2011 (NO SP1)을 사용하고

Uncaught TypeError: Cannot call method 'GetPublicationData' of undefined 
CMSExtensions.Popups.PublicationInfo._onExecuteButtonClickedPublicationInfo_v6.0.0.39607.0_.aspx:433 
(anonymous function)PublicationInfo_v6.0.0.39607.0_.aspx:2 
EventRegister.f.executeListenerPublicationInfo_v6.0.0.39607.0_.aspx:16 
aPublicationInfo_v6.0.0.39607.0_.aspx:16 
Tridion.ObjectWithEvents.processHandlersPublicationInfo_v6.0.0.39607.0_.aspx:14 
Tridion.ObjectWithEvents.fireEventPublicationInfo_v6.0.0.39607.0_.aspx:14 
Tridion.Controls.Button.onclickPublicationInfo_v6.0.0.39607.0_.aspx:428 
Tridion.Controls.Button.onmouseupPublicationInfo_v6.0.0.39607.0_.aspx:428 
(anonymous function)PublicationInfo_v6.0.0.39607.0_.aspx:2 
EventRegister.f.executeListenerPublicationInfo_v6.0.0.39607.0_.aspx:16 
a 

. 올바르게 모델의 설정에서 사용자 정의 웹 서비스를 포함하는 경우

<serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service name="CMSExtensions.Model.Services.PublicationInfo" behaviorConfiguration="Tridion.Web.UI.ContentManager.WebServices.DeveloperBehavior"> 
     <endpoint name="PublicationInfo" address="" behaviorConfiguration="Tridion.Web.UI.ContentManager.WebServices.AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="Tridion.Web.UI.ContentManager.WebServices.WebHttpBindingConfig" contract="CMSExtensions.Model.Services.PublicationInfo"/> 
     </service>  
    </services> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 
+0

웹 서비스 코드와 명령의 JavaScript도 함께 공유 할 수 있습니까? 그것들이 없으면 여기에서 잘못된 것이 무엇인지보기가 꽤 어렵습니다. –

+0

@FrankvanPuffelen - 코드 스 니펫을 추가했습니다. – sachspeak

+0

해당 구성의 들여 쓰기를 수정하십시오. 모든 텍스트 편집기에서이 작업을 수행 할 수 있으며 모든 사용자가 쉽게 읽을 수 있습니다. –

답변

2

:

<cfg:groups> 
      <cfg:group name="CMSExtensions.Model.Services" merger="Tridion.Web.UI.Core.Configuration.Resources.DomainModelProcessor" merge="always"> 
       <cfg:domainmodel name="CMSExtensions.Model.Services"> 
        <cfg:fileset> 
         <!-- <cfg:file type="script">/Scripts/Constants.js</cfg:file> --> 
        </cfg:fileset> 

        <cfg:services>      
         <cfg:service type="wcf">/Services/PublicationInfo.svc</cfg:service> 
        </cfg:services> 
       </cfg:domainmodel> 
      </cfg:group> 
     </cfg:groups> 

의 Web.config 항목 : 여기

는 서비스 코드를

using System.Collections.Generic; 
using System.Linq; 
using System.ServiceModel; 
using System.ServiceModel.Activation; 
using System.ServiceModel.Web; 
using CMSExtensions.Model.Progress; 
using Tridion.Web.UI.Models.TCM54; 


namespace CMSExtensions.Model.Services 
{ 

    [ServiceContract(Namespace = "http://CMSExtensions.Model.Services", Name = "PublicationInfo")] 
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] 

    public class PublicationInfo : WCFServiceBase 
    { 
     [OperationContract] 
     [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, 
         ResponseFormat = WebMessageFormat.Json)] 
     public string GetUserDescription() 
     { 
      return "sachin"; 
     } 
    } 
} 

모델 구성입니다 파일은 서비스 호출을위한 JavaScript 프록시를 생성합니다. 생성 된 JavaScript 코드는 브라우저의 디버깅 도구에서 찾을 수있는 Default.aspx? mode = js 파일에서 찾을 수 있습니다.

JavaScript 프록시가없는 경우 System.config에서 업데이트 번호를 늘리십시오. 이 작업을 수행했지만 프록시가 여전히 표시되지 않으면 생성 된 JavaScript 및 이벤트 로그에서 오류 메시지를 확인하십시오.

4

Tridion.Web.UI.ContentManager.WebServices.DeveloperBehavior는 WebRoot 디렉토리의 web.config 파일에 정의되어 있습니다. 그래서 가장 가능성이 다른 응용 프로그램 (풀)에서 이것을 실행하려고합니다.

귀하의 모델과 편집기가 응용 프로그램이 아닌 단지 가상 디렉터리 인 IIS인지 확인하는 것이 좋습니다.

+0

웹 응용 프로그램이 아닌 Vdir로 설정됩니다. – sachspeak

+0

그건 아주 이상합니다. 그것은 그것을 상속해야합니다. 자신의 web.config에 동작을 복사하려고 시도한 적이 있습니까? –

관련 문제