C++/Cx の github サンプルに従って、winrt/c++ で AppService を使用しようとしています。私は常に「AppUnavailable」という結果を受け取ります。正しいサービス名に接続し、正しいファミリー パッケージ名を持っていることを確認しました。
私のappxmanifest:
<Extensions>
<uap:Extension Category="windows.appService" EntryPoint="BlankApp5.Inventory">
<uap3:AppService Name="com.microsoft.inventory" uap4:SupportsMultipleInstances="true"/>
</uap:Extension>
</Extensions>
私のプロバイダー ヘッダー ファイル (Mainpage.h 内):
namespace winrt::BlankApp5::implementation
{
class Inventory : public InventoryT<Inventory> {
public:
virtual void Run(IBackgroundTaskInstance taskInstance);
private:
BackgroundTaskDeferral mDef;
AppServiceConnection appServiceConnection;
};
私の MainPage.idl ファイル:
[default_interface]
runtimeclass Inventory : Windows.ApplicationModel.Background.IBackgroundTask
{
void Run(Windows.ApplicationModel.Background.IBackgroundTaskInstance taskInstance);
}
IDL の生成中に、次の警告が表示されます。
[msg]A member name has been qualified with an interface name because name collisions occurred across interface members on a runtime class. [context]"Run" has been renamed as "BlankApp5.IInventory.Run" on runtime class "BlankApp5.Inventory"
Inventory::Run はサービス プロバイダーの内部で使用されていないため、リンカによって削除されるのではないかと少し心配していますが、機能しない理由が他にわかりません。プロバイダーとクライアントは 2 つの異なるソリューションにあり、相互に参照はありませんが、これは必要ないと思います。サービス プロバイダーはデプロイされましたが、起動されていません。起動しても違いはありません。