C# WCF客户端不接受来自服务的响应。由于EndpointDispatcher上的AddressFilter不匹配,无法在接收器上处理
我第一次写了一些与wcf相关的东西,我根据文档等做了所有事情,但我不理解为什么我的客户不想从服务接收数据。此外,它只接受来自服务本身的数据,我不在客户端调用方法,这是否意味着我有单向wsHttpBinding 任务如下:服务从客户端接收矩阵大小(5x5)和用于确定如何生成矩阵本身的枚举标识符,在服务器上生成指定维度的随机矩阵,并将矩阵返回给客户端。 然后,该矩阵将再次传输到服务,以便使用它进行操作。 问题是,当矩阵为返回给客户端,错误在调用GetMatrix方法的行中 接收对的HTTP响应时出错。这可能是由于服务端点绑定未使用HTTP协议造成的 ServiceTrace告诉我该错误: 由于EndpointDispatcher上的AddressFilter不匹配,无法在接收器上处理收件人为“”的消息。检查发送方和接收方的端点地址是否一致 看,如果我传递给客户的不是矩阵,而是null,那么客户机接受它。5x5矩阵拒绝。类似地,C# WCF客户端不接受来自服务的响应。由于EndpointDispatcher上的AddressFilter不匹配,无法在接收器上处理,c#,wcf,wcf-binding,wcfserviceclient,C#,Wcf,Wcf Binding,Wcfserviceclient,我第一次写了一些与wcf相关的东西,我根据文档等做了所有事情,但我不理解为什么我的客户不想从服务接收数据。此外,它只接受来自服务本身的数据,我不在客户端调用方法,这是否意味着我有单向wsHttpBinding 任务如下:服务从客户端接收矩阵大小(5x5)和用于确定如何生成矩阵本身的枚举标识符,在服务器上生成指定维度的随机矩阵,并将矩阵返回给客户端。 然后,该矩阵将再次传输到服务,以便使用它进行操作。 问题是,当矩阵为返回给客户端,错误在调用GetMatrix方法的行中 接收对的HTTP响应时
向量
。
我不明白问题是什么,谷歌搜索没有返回结果。给出方向,看看哪里或者我哪里错了?)
服务App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="WCF_TRSPO_Lib.Service1">
<endpoint address="" binding="wsHttpBinding" contract="WCF_TRSPO_Lib.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/WCF_TRSPO/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
数据集返回到客户端的服务数据源
[DataContract]
public class ObjectObgortka
{
public ObjectObgortka()
{
_Matrix = null;
_Vector = null;
}
public Matrix<double> _Matrix;
public Vector<double> _Vector;
[DataMember]
public Matrix<double> Matrix { get { return _Matrix; } set { _Matrix = value; } }
[DataMember]
public Vector<double> Vector { get { return _Vector; } set { _Vector = value; } }
和客户
public static void Main(string[] args)
{
//Step 1: Create an instance of the WCF proxy.
Service1Client client = new Service1Client();
// Step 2: Call the service operations.
// Call the Add service operation.
Console.Write("N: ");
int n = Convert.ToInt32(Console.ReadLine());
var matrixA = client.GetMatrixData(n, MatrixEnum.A); //here var is ObjectObgortka type from Servic
Matrix<double> MatrixA = matrixA.Matrix;
publicstaticvoidmain(字符串[]args)
{
//步骤1:创建WCF代理的实例。
Service1Client客户端=新的Service1Client();
//步骤2:调用服务操作。
//调用添加服务操作。
控制台。写(“N:”);
int n=Convert.ToInt32(Console.ReadLine());
var matrixA=client.GetMatrixData(n,MatrixEnum.A);//这里的var是Servic中的ObjectObgortka类型
矩阵MatrixA=矩阵MatrixA.矩阵;
MathNET.Multudio.CalthalCopy.Data DenseMatrix .'具有数据契约名' DigaCortReal.Data Cornor.org/2004/07….. '是不可预期的.考虑使用DATACONTRORTCHORDER器,或者在已知类型的列表中添加静态不知道的任何类型.例如,使用NoNyType属性或将它们添加到传递给序列化程序的已知类型列表中
该错误通常表示服务器端和客户端不知道如何序列化和反序列化复杂数据类型。由于WCF无法识别
Maxtrix
,Vector
,因此我们必须告诉他数据类型结构是什么,以及如何将其序列化为XML(HTTP中的有效负载)。
请考虑用DATACONTRORT属性装饰复杂类型,并使用已知类型指定在序列化之前应考虑的类型。
[DataContract]
[KnownType(typeof(CircleType))]
[KnownType(typeof(TriangleType))]
public class CompanyLogo2
{
[DataMember]
private Shape ShapeOfLogo;
[DataMember]
private int ColorOfLogo;
}
[DataContract]
public class Shape { }
[DataContract(Name = "Circle")]
public class CircleType : Shape { }
[DataContract(Name = "Triangle")]
public class TriangleType : Shape { }
有关更多详细信息,如果有什么我能帮忙的,请随时告诉我
MathNET.Multudio.CalthalCopy.Data DenseMatrix .'具有数据契约名' DigaCortReal.Data Cornor.org/2004/07….. '是不可预期的.考虑使用DATACONTRORTCHORDER器,或者在已知类型的列表中添加静态不知道的任何类型.例如,使用NoNyType属性或将它们添加到传递给序列化程序的已知类型列表中
该错误通常表示服务器端和客户端不知道如何序列化和反序列化复杂数据类型。由于WCF无法识别
Maxtrix
,Vector
,因此我们必须告诉他数据类型结构是什么,以及如何将其序列化为XML(HTTP中的有效负载)。
请考虑用DATACONTRORT属性装饰复杂类型,并使用已知类型指定在序列化之前应考虑的类型。
[DataContract]
[KnownType(typeof(CircleType))]
[KnownType(typeof(TriangleType))]
public class CompanyLogo2
{
[DataMember]
private Shape ShapeOfLogo;
[DataMember]
private int ColorOfLogo;
}
[DataContract]
public class Shape { }
[DataContract(Name = "Circle")]
public class CircleType : Shape { }
[DataContract(Name = "Triangle")]
public class TriangleType : Shape { }
有关更多详细信息,如果有什么我可以帮忙的,请尽管告诉我。< /P>服务跟踪的新消息^类型“MthNET.No.Calmith.DigialMealth.Bug,DenseMatrix”,数据名为“DexEMeTimRix:”,如果您使用DATACONTROTTRORIGLASTER或在已知T的列表中添加静态不知道的任何类型,请考虑使用DATACONTracTracever。例如,通过使用NoNyType属性或将它们添加到传递给序列化程序的已知类型的列表中,不希望从Service Trace~类型的“MasNET.No.Calmith.DigialMeal.Douth.DenseMatrix”中获得新的带有数据契约名“DexEMeTrime:”的消息。如果使用DATACONTROTCTRESIDEA,请考虑使用DATACONTracTracever。lizer或将任何静态未知的类型添加到已知类型列表中—例如,使用KnownTypeAttribute属性或将它们添加到传递给序列化程序的已知类型列表中。
public static void Main(string[] args)
{
//Step 1: Create an instance of the WCF proxy.
Service1Client client = new Service1Client();
// Step 2: Call the service operations.
// Call the Add service operation.
Console.Write("N: ");
int n = Convert.ToInt32(Console.ReadLine());
var matrixA = client.GetMatrixData(n, MatrixEnum.A); //here var is ObjectObgortka type from Servic
Matrix<double> MatrixA = matrixA.Matrix;
[DataContract]
[KnownType(typeof(CircleType))]
[KnownType(typeof(TriangleType))]
public class CompanyLogo2
{
[DataMember]
private Shape ShapeOfLogo;
[DataMember]
private int ColorOfLogo;
}
[DataContract]
public class Shape { }
[DataContract(Name = "Circle")]
public class CircleType : Shape { }
[DataContract(Name = "Triangle")]
public class TriangleType : Shape { }