汎用アプリケーションからWCFサービスを呼び出すことは可能ですか?汎用アプリケーションのWCFクライアント
サービス参照を追加しましたが、プロキシが正しく生成されました。 しかし、NetTcpBindingをプログラムで作成し、それをプロキシのコンストラクタに渡すと、サービスモデルはPlatformNotSupported例外をスローします。
シミュレータとローカルマシンの両方でアプリを実行すると同じ例外が生成されます。
タイプ 'System.PlatformNotSupportedException' の例外がSystem.Private.ServiceModel.dllに を発生しなく
EndpointAddress address = new EndpointAddress("net.tcp://test:9000/ServicesHost/PublishService");
NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.None;
PublishingService.PublishClient proxy = new PublishingService.PublishClient(binding, address);
"この操作はサポートされていない" ユーザーコードで処理されませんでした
UAPにWCFクライアントが動作している例はありますか?
EDIT
それはサービスが両面サービスであることとは何かを持っています!
当初の契約:
[ServiceContract(CallbackContract = typeof(IPublishCallback))]
public interface IPublish { }
CallbackContractを除去した後は、UAPクライアントが接続を作成することができます属性なので、基本的なWCFは動作します。 質問を言い換えるとよいでしょう。 普遍的なアプリケーションで二重 WCFクライアントを作成することはできますか?
編集ホストの servicemodel
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="netTcpPublishService" openTimeout="00:00:10" receiveTimeout="infinite">
<reliableSession inactivityTimeout="24.20:31:23.6470000" enabled="true" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehaviour">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="serviceBehaviour" name="PublishService.Publish">
<endpoint binding="mexHttpBinding" name="mexPublishService"
contract="IMetadataExchange" />
<endpoint address="PublishService" binding="netTcpBinding" bindingConfiguration="netTcpPublishService"
name="netTcpPublishService" contract="PublishService.IPublish" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8004/ServicesHost/PublishService" />
<add baseAddress="net.tcp://localhost:9004/ServicesHost/PublishService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
私は自分のアプリケーションでそれをやったことがあるはずです(ただし、プロキシコンストラクタに何も渡さずに、適用されない可能性があります)。 – Tobbe
はWindows 10 UWPアプリでこれは? –