2

空白の Windows 8 アプリにサービス参照を追加しようとすると、次の 2 つの警告/エラーが発生します。

TransportSecurityBindingElement

このサービスは、ServiceName.svc ファイルを含む wcf サービスです。ServiceName.asmx を含むいくつかのサービスを見てきました。これが原因ですか?*.asmx ファイルを含むサービスが必要ですか?

このトピックについては、インターネット上にあまりにも多くの奇抜なものがあるため、私は本当に混乱しています. また、紛らわしいのは、System.ServiceModel.Channels.TransportSecurityBindingElement がサポートされていないということですが、私はこれを使用したことがありません。web.config またはサービス構成としてのコードではありません。

ここで、web.config の私のサービス構成:

<system.web>
  <compilation targetFramework="4.5" debug="true"/>
  <httpRuntime/>
  <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.serviceModel>
<diagnostics>
  <messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"/>
</diagnostics>
<client/>
<services>
  <service behaviorConfiguration="basicHttpBehavior" name="e3kConnector.E3KConnectorService">
    <endpoint 
      address="mex" 
      binding="mexHttpBinding" 
      contract="IMetadataExchange" />
    <endpoint 
      address="" 
      binding="wsHttpBinding" 
      bindingConfiguration="wsHttpBinding"
      name="wsHttpEndpoint" 
      bindingName="" 
      contract="Service.MyService" />
    <endpoint 
      address="Soap" 
      binding="basicHttpBinding"
      bindingConfiguration="basicHttpBinding" 
      name="basicHttpBinding"
      bindingName=""
      contract="Service.MyService" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:50282/Service.svc" />
      </baseAddresses>
    </host>
  </service>
</services>
<bindings>
  <basicHttpBinding>
    <binding name="basicHttpBinding" allowCookies="true">
      <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="Basic" proxyCredentialType="None" />
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </basicHttpBinding>
  <wsHttpBinding>
    <binding name="wsHttpBinding" allowCookies="true">
      <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="Basic" />
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="basicHttpBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="e3kConnector.App_Data.Security.CustomUserNameValidator,e3kConnector"/>
        <serviceCertificate findValue="tempCert" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName"/>
      </serviceCredentials>
      <serviceAuthorization principalPermissionMode="Custom">
        <authorizationPolicies>
          <add policyType="e3kConnector.App_Data.Security.AuthorizationPolicy, e3kConnector"/>
        </authorizationPolicies>
      </serviceAuthorization>
    </behavior>
  </serviceBehaviors>
</behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="false"/>
</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>

テストとして、このtempConverterを追加しましたが、これは機能します。(はい、asmx ファイルであることは知っています。) svc と asmx の違いも知っていますが、それが原因で混乱しています。どちらも SOAP をサポートしているため、なぜ動作しないのかはまだわかりません。多分それは非常に簡単ですか?

詳細が必要な場合は、お知らせください。

4

1 に答える 1

1

これは、Windows ストア クライアント アプリが WCF のごく一部しかサポートしていないために発生しています。

サービスでこのスリム化された構成を試してください (バインディング wsHttp、動作、およびバインディング構成を削除しました):

<system.serviceModel>
  ....
  <services>
    <service name="e3kConnector.E3KConnectorService">
      <endpoint
        address="mex"
        binding="mexHttpBinding"
        contract="IMetadataExchange" />
      <endpoint
        address=""
        binding="basicHttpBinding"
        name="basicHttpBinding"
        contract="Service.MyService" />
      <host>
        <baseAddresses>
          <add baseAddress="http://localhost:50282/Service.svc" />
        </baseAddresses>
      </host>
    </service>
  </services>
  ....
</system.serviceModel>
于 2013-09-20T13:40:49.520 に答える