WCF 测试客户端:添加服务失败。服务元数据可能无法访问。确保您的服务正在运行并公开元数据

发布于 2024-12-11 19:12:55 字数 1413 浏览 0 评论 0原文

我目前正在尝试使同步框架示例正常工作: 示例

解决方案编译时没有任何错误或警告。

但是当我按 F5 时,WCF 测试客户端启动并抛出以下错误。

本地\临时\测试客户端 项目\10.0\5b6aab8a-6629-4a12-87c2-e9e75ba9c1e4\Client.cs(379,13): 错误CS0246:找不到类型或命名空间名称“架构” (您是否缺少 using 指令或程序集引用?)

下面是来自 Client.cs 的代码,上面的错误正在引用它,

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/Microsoft.Synchronization")]
public partial class SyncIdFormatGroup
{
    private schema schemaField;
    private System.Xml.XmlElement anyField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.w3.org/2001/XMLSchema", Order=0)]
    public schema schema
    {
        get { return this.schemaField; }
        set { this.schemaField = value; }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlAnyElementAttribute(Order=1)]
    public System.Xml.XmlElement Any
    {
        get { return this.anyField; }
        set { this.anyField = value; }
    }
}

如果有人可以帮助我解决该问题,那就太好了。

I am currently trying to get the sync framework sample working: sample

The solution compiles with out any error or warning.

But when I hit F5 the WCF Test Client launches and throws the following error.

Local\Temp\Test Client
Projects\10.0\5b6aab8a-6629-4a12-87c2-e9e75ba9c1e4\Client.cs(379,13) :
error CS0246: The type or namespace name 'schema' could not be found
(are you missing a using directive or an assembly reference?)

Below is the code from Client.cs that the above error is referencing

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.datacontract.org/2004/07/Microsoft.Synchronization")]
public partial class SyncIdFormatGroup
{
    private schema schemaField;
    private System.Xml.XmlElement anyField;

    /// <remarks/>
    [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.w3.org/2001/XMLSchema", Order=0)]
    public schema schema
    {
        get { return this.schemaField; }
        set { this.schemaField = value; }
    }

    /// <remarks/>
    [System.Xml.Serialization.XmlAnyElementAttribute(Order=1)]
    public System.Xml.XmlElement Any
    {
        get { return this.anyField; }
        set { this.anyField = value; }
    }
}

It would be great if some one could help me with the problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

假情假意假温柔 2024-12-18 19:12:55

找到了解决方案好吧,花了很多时间我破解了它。由于某种原因,如果我将示例作为控制台应用程序运行,它就可以正常工作。但是当我使用 WCFTestClient 时,我遇到了错误。如果我从合同中删除 [ServiceKnownType(typeof(SyncIdFormatGroup))] ,它将在 WCFTestClient 中运行。希望对某人有帮助。

Found the solution Ok, after spending lot of time I cracked it. For some reason if I run the sample as console app it just works fine. But the moment I use WCFTestClient I was getting errors. If I remove the [ServiceKnownType(typeof(SyncIdFormatGroup))] from the contract it works in WCFTestClient. Hope that helps someone.

一念一轮回 2024-12-18 19:12:55

您是否在服务中启用了 mex(元数据交换)端点?

<endpoint 
      address="mex" 
      binding="mexHttpBinding" 
      contract="IMetadataExchange"/>

Have you enabled a mex (metadata exchange) endpoint in your service?

<endpoint 
      address="mex" 
      binding="mexHttpBinding" 
      contract="IMetadataExchange"/>
懒猫 2024-12-18 19:12:55

阅读本页末尾的注释:
注意:如果您使用 Visual Studio 2010 编译这些示例,则首先需要删除对 Sync Framework 程序集的引用,然后将程序集引用重新添加到项目中。否则,您将看到“找不到类型或命名空间名称”编译错误。
http://code.msdn.microsoft.com/Database-Sync -SQL-Server-7e88adab#content
或者
http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208

Read the note at the end of the page:
Note: If you use Visual Studio 2010 to compile these samples, you will first need to remove references to the Sync Framework assemblies and then re-add the assembly references to the projects. Otherwise, you will see "type or namespace name could not be found" compilation errors.
http://code.msdn.microsoft.com/Database-Sync-SQL-Server-7e88adab#content
or
http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文