【问题标题】:Trying to create a web service in VS 2008 and I can't get the wsdl and disco files created尝试在 VS 2008 中创建 Web 服务,但无法创建 wsdl 和 disco 文件
【发布时间】:2010-08-18 23:17:44
【问题描述】:

如何使用 Visual Studio 2008 为 Web 服务创建 wsdl 和 disco 文件?我可以创建服务并通过 VS 运行它,但是当我尝试创建文件时没有任何反应。我还需要此服务在 sharepoint 2007 和外部 sharepoint 中运行。

【问题讨论】:

  • 请添加详细信息,例如“当我尝试创建文件时没有任何反应”的意思,以及您是在创建 .asmx 服务还是 WCF 服务。

标签: asp.net web-services sharepoint-2007


【解决方案1】:

在 sharepoint 中创建 wsdl 和 disco 文件很痛苦。在将项目部署到 SharePoint 上下文之前,您必须从 Visual Studio 的开发服务器运行项目并针对 asmx 运行 disco.exe。 此外,将文件部署到 SharePoint 上下文时,您必须重命名文件 wsdl.aspx 和 disco.aspx。

最后,在 SharePoint 上下文中,您必须手动修改 wsdl(有关此内容的更多信息,请参阅开箱即用的 SharePoint wsdl)。你必须用这个替换你上面的所有xml节点。

<%@ Page Language="C#" Inherits="System.Web.UI.Page" %>
<%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<% Response.ContentType = "text/xml"; %>

您必须将您的 SOAP 地址位置属性替换为:

<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %>

【讨论】:

  • 我对 Web 服务和共享点非常陌生。所以我只是在开发机器上创建服务,然后在它仍在开发机器上时对其运行 disco.exe?要部署到服务器,我只需将 wsdl 和 disco 文件复制到服务器
  • 好吧,您将在开发机器上创建服务并在其上运行 disco.exe,但您必须修改和重命名生成的文件(.disco 和 .wsdl ) 如您在部署它们之前所描述的那样。
猜你喜欢
  • 2010-10-07
  • 2022-08-06
  • 2015-05-03
  • 1970-01-01
  • 2021-01-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多