C# 具有多个端点的WCF服务出现HTTP错误请求(400)错误
我已经编写了具有以下配置的WCF服务:C# 具有多个端点的WCF服务出现HTTP错误请求(400)错误,c#,wcf,C#,Wcf,我已经编写了具有以下配置的WCF服务: <system.serviceModel> <services> <service name="SyncService" behaviorConfiguration="SyncServiceBehavior"> <endpoint name="DataBinding" address="/DataBinding" binding="wsHttpBinding" contract="IS
<system.serviceModel>
<services>
<service name="SyncService" behaviorConfiguration="SyncServiceBehavior">
<endpoint name="DataBinding" address="/DataBinding" binding="wsHttpBinding" contract="ISyncService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint name="FileBinding" address="/FileBinding" binding="basicHttpBinding" bindingConfiguration="httpLargeMessageStream" contract="ISyncService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="httpLargeMessageStream" maxReceivedMessageSize="2147483647" transferMode="Streamed" messageEncoding="Mtom" />
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="SyncServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
当我在浏览器中查看SyncService.svc时,我会看到“You have created a service”页面,所有内容看起来都是正确的。wsdl看起来也很合适。当我转到http://localhost/SyncService.svc/FileBinding
加载了一个空白页面(与转到类似http://localhost/SyncService.svc/XXX
)
我曾涉猎过许多类似的问题,但都无济于事,包括:
有人对如何解决这个问题有什么想法或建议吗?您可以尝试使用Fiddler之类的工具检查发送到服务器的请求吗。soap信封中一定有导致问题的东西 另外,最初尝试发送小数据以确保您的服务是可访问的,然后尝试发送大数据以缩小问题的范围 您是否实现了异步模式,或者您的web服务是否标记为async=True
如果您也可以发布您的服务,这将很有帮助。您可以尝试使用Fiddler之类的工具检查发送到服务器的请求吗。soap信封中一定有导致问题的东西 另外,最初尝试发送小数据以确保您的服务是可访问的,然后尝试发送大数据以缩小问题的范围 您是否实现了异步模式,或者您的web服务是否标记为async=True
如果您也可以发布您的服务,这将很有帮助。事实证明,此问题不是由合同对象引起的,而是由未找到其引用的对象引起的。就我而言,我忘记在服务器上安装所有必需的Microsoft Sync Framework部件
我猜这个故事的寓意是,这个错误是相当误导性的,也适用于所有的儿童对象 事实证明,此问题不是由合同对象引起的,而是由未找到其引用的对象引起的。就我而言,我忘记在服务器上安装所有必需的Microsoft Sync Framework部件
我猜这个故事的寓意是,这个错误是相当误导性的,也适用于所有的儿童对象 有趣的更新,即使在抛出错误请求时正在使用FileBinding的代理对象,Service Trace Viewer仍会在侦听数据绑定端点时显示错误。通过翻转端点在服务器上的配置文件中出现的顺序,我可以在侦听FileBinding端点时引发相同的错误。从配置中的地址属性中删除斜杠是否有任何效果?@degorolls,没有。我尝试了两种方法,得到了完全相同的结果。有趣的更新,即使在抛出错误请求时正在使用FileBinding的代理对象,Service Trace Viewer仍会在侦听数据绑定端点时显示错误。通过翻转端点在服务器上的配置文件中出现的顺序,我可以在侦听FileBinding端点时引发相同的错误。从配置中的地址属性中删除斜杠是否有任何效果?@degorolls,没有。我尝试了两种方法,得到了完全相同的结果。
private static RemoteFileProviderProxy CreateDynamicFileProxy(string endPointAddress)
{
//endPointAddress = http://localhost/SyncService.svc/FileBinding
BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "httpLargeMessageStream";
binding.TransferMode = TransferMode.Streamed;
binding.MessageEncoding = WSMessageEncoding.Mtom;
binding.MaxReceivedMessageSize = int.MaxValue;
ServiceEndpoint endPoint = new ServiceEndpoint(ContractDescription.GetContract (typeof(ISyncService)), binding, new EndpointAddress(endPointAddress));
endPoint.Name = "FileBinding";
ChannelFactory<ISyncService> channelFactory = new ChannelFactory<ISyncService>(endPoint);
return new RemoteFileProviderProxy((ISyncService)channelFactory.CreateChannel());
}
at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)