Có thể gọi dịch vụ WCF từ một ứng dụng toàn cầu không?Ứng dụng WCF trong ứng dụng toàn cầu
Tôi đã thêm tham chiếu dịch vụ và proxy được tạo tốt. Nhưng khi tạo một NetTcpBinding lập trình và truyền nó tới constructor của proxy, mô hình dịch vụ sẽ ném ngoại lệ PlatformNotSupported.
Cả hai chạy ứng dụng trong trình mô phỏng và trên máy cục bộ cũng tạo ra cùng một ngoại lệ.
Một ngoại lệ của loại 'System.PlatformNotSupportedException' xảy ra trong System.Private.ServiceModel.dll nhưng không được xử lý theo mã người dùng
"hoạt động này không được hỗ trợ"
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);
Có ai có ví dụ về máy khách WCF đang hoạt động trong UAP không?
EDIT
Nó có cái gì để làm với các dịch vụ trở thành một dịch vụ duplex!
Hợp đồng gốc:
[ServiceContract(CallbackContract = typeof(IPublishCallback))]
public interface IPublish { }
Sau khi loại bỏ các thuộc tính CallbackContract client UAP có thể tạo ra một kết nối, vì vậy cơ bản WCF hoạt động. Vì vậy, tôi đoán tốt hơn là nên thuật lại câu hỏi. Có thể tạo một máy khách WCF duplex WCF trong ứng dụng toàn cầu không?
chỉnh sửa servicemodel cho các máy chủ
<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>
Có thể, tôi đã thực hiện nó trong ứng dụng của mình (mặc dù không truyền bất kỳ thứ gì cho nhà xây dựng proxy, vì vậy có thể không áp dụng được). – Tobbe
có nằm trong ứng dụng UWP của Windows 10 không? –