同じWCFサービスでSOAPとRESTfulを使用しようとしています。私は1つの問題から離れてそれをも痛感しました。私はすべてのエンドポイントを持っている場合SOAP、JSON、POX同じ安いwcf
<service behaviorConfiguration="webBehaviour" name="MyServices">
<clear />
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp"
name="basicHttpBinding" contract="DJSharedServices.IMyServices" />
<endpoint address="ws" binding="wsHttpBinding" bindingConfiguration="WsHttp"
name="wsHttpBinding" contract="DJSharedServices.IMyServices" />
<endpoint address="web" binding="webHttpBinding" bindingConfiguration="WebHttp" behaviorConfiguration="webBehavior"
name="webHttpBinding" contract="DJSharedServices.IMyServices" />
<endpoint address="json" binding="webHttpBinding" bindingConfiguration="WebHttp" behaviorConfiguration="webJSONBehavior"
name="webJSONHttpBinding" contract="DJSharedServices.ISharedServices" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" name="mexBinding" />
</service>
</services>
は、それが次のエラーを与える:次は私のweb.configファイルである私は、JSONのエンドポイントをコメントアウト場合
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.ServiceModel.Description.WsdlExporter.CreateWsdlBindingAndPort(ServiceEndpoint endpoint, XmlQualifiedName wsdlServiceQName, Port& wsdlPort, Boolean& newBinding, Boolean& bindingNameWasUniquified)
at System.ServiceModel.Description.WsdlExporter.ExportEndpoint(ServiceEndpoint endpoint, XmlQualifiedName wsdlServiceQName)
at System.ServiceModel.Description.WsdlExporter.ExportEndpoints(IEnumerable`1 endpoints, XmlQualifiedName wsdlServiceQName)
at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.Get(Message message)
at SyncInvokeGet(Object , Object[] , Object[])
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
物事はうまく動作します。
あなたは私が理由を見つけるのを助けてもらえますか?
ありがとうございます。
なぜ2つのエンドポイントがwsdlのバインディングを共有できないのでしょうか? – JeremyWeir
@ Jayrdub別のアドレスが必要で、別のアドレスには異なるプロキシが必要だと思います。 – genericuser
確かに、WebAPIのようなWCFの機能はないので、URL = "json"、address = "xml" yada yadaを取り出してURLをきれいに保つことができます。 WebApiはあなたのコンテンツタイプを調べて、あなた自身のサービスと設定のコードで素晴らしいタイムセーバーであることを示します。 – PositiveGuy