[英]WCF Test Client : Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata
I am currently trying to get the sync framework sample working: sample 我目前正在尝试使用同步框架示例: 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. 但是当我点击F5时,WCF测试客户端启动并抛出以下错误。
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?)
Local \\ Temp \\ Test Client Projects \\ 10.0 \\ 5b6aab8a-6629-4a12-87c2-e9e75ba9c1e4 \\ Client.cs(379,13):错误CS0246:找不到类型或命名空间名称'schema'(您是否错过了使用指令或程序集引用?)
Below is the code from Client.cs
that the above error is referencing 以下是
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; }
}
}
It would be great if some one could help me with the problem. 如果有人可以帮我解决这个问题,那将会很棒。
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.
但是当我使用WCFTestClient时,我收到了错误。 If I remove the
[ServiceKnownType(typeof(SyncIdFormatGroup))]
from the contract it works in WCFTestClient. 如果我从合同中删除
[ServiceKnownType(typeof(SyncIdFormatGroup))]
,它在WCFTestClient中工作。 Hope that helps someone. 希望能帮助别人。
Have you enabled a mex (metadata exchange) endpoint in your service? 您是否在服务中启用了mex(元数据交换)端点?
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"/>
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. 阅读页面末尾的注释:注意:如果使用Visual Studio 2010编译这些示例,则首先需要删除对Sync Framework程序集的引用,然后将程序集引用重新添加到项目中。 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
http://code.msdn.microsoft.com/Database-Sync-SQL-Server-7e88adab#content或http://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.