在ASP.NET中使用Tridion 2011 links.svc服务

Jon*_*mer 9 tridion

尝试在我的ASP.NET应用程序中向/linking.svc添加服务引用时收到以下错误:

下载时出错http://localhost:82/linking.svc/.请求失败,HTTP状态为404:未找到.元数据包含无法解析的引用:http://localhost:82/linking.svc/.没有端点监听http://localhost:82/linking.svc/可以接受该消息.这通常是由错误的地址或SOAP操作引起的.有关更多详细信息,请参阅InnerException(如果存在).远程服务器返回错误:(404)Not Found.如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用.

我认为我可以像odata一样使用链接服务(在Visual Studio中添加服务引用),因为odata对我来说很好.我检查了我的服务安装的web.config,并且两个端点看起来都配置正确.

<!-- HTTP support -->
        <service name="Tridion.ContentDelivery.Webservice.ODataService">
            <endpoint behaviorConfiguration="webHttp" bindingConfiguration="HttpBinding" binding="webHttpBinding" contract="Tridion.ContentDelivery.Webservice.IODataService" />
        </service>
        <service name="Tridion.ContentDelivery.Webservice.LinkingService">
            <endpoint behaviorConfiguration="webHttp" bindingConfiguration="HttpBinding" binding="webHttpBinding" contract="Tridion.ContentDelivery.Webservice.Ilinking" />
        </service>
        <service name="Tridi
Run Code Online (Sandbox Code Playgroud)

我假设我试图以不正确的方式使用linking.svc.

我的问题 ...我是否遵循在Visual Studio ASP.NET项目中使用linking.svc服务的正确过程?如果没有,请你帮我理解如何利用这个api.

非常感谢

Fra*_*len 6

您是否考虑为链接服务编写自己的客户端?这是一个非常简单的REST-ful Web服务,因此您可以使用标准访问它WebClient:

从Mihai Cadariu的一个例子来看:

WebClient client = new WebClient();
string linkingServiceUrl = "http://tridion.server:8080/services/linking.svc";
string COMPONENT_LINK = "/componentLink?sourcePageURI={0}&targetComponentURI={1}&excludeTemplateURI={2}&linkTagAttributes={3}&linkText={4}&showTextOnFail={5}&showAnchor={6}";
string url = linkingServiceUrl +
    string.Format(COMPONENT_LINK,
    sourcePageUri,
    targetComponentUri,
    excludeTemplateUri,
    HttpUtility.UrlEncode(linkTagAttributes),
    HttpUtility.UrlEncode(linkText),
    showTextOnFail,
    showAnchor);
return client.DownloadString(url);
Run Code Online (Sandbox Code Playgroud)