5

Windows Phone のプッシュ通知を実装するための本のチュートリアルに従っています。これはサービスのマークアップです:

<%@ ServiceHost Language="C#" Debug="true" Service="Service.PushService" CodeBehind="PushService.svc.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>

ご覧のとおり、工場が追加されていますが、それが何のためにあるのかよくわかりません。サービスを実行すると、"endpoint not found"エラーが発生します。マークアップからファクトリを削除すると、エラーは消えますが、空のページが表示されます。

このエラーの原因や修正方法について何か考えはありますか? さらにコードが必要な場合は、教えてください。

ありがとう

編集:私のweb.config:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>
4

2 に答える 2

9

web.config にエンドポイント構成がありません。

これを web.config に追加します。

<system.serviceModel>
  <services>
    <service name="Service.PushService">
      <endpoint address="" binding="basicHttpsBinding"
                contract="Service.IPushService" />
    </service>
  </services>
</system.serviceModel>
于 2013-03-05T10:09:31.400 に答える