1

POSTを使用してアンドロイドからファイルを受け入れるためのWCFアプリケーションを作成していますが、System.ServiceModel.ServiceActivation例外がスローされます。リンクから何をすべきかを理解しました:-

wcf サービスの System.ServiceModel.ServiceActivationException

以下は、Web.config ファイルです。

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

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="Service1Behavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="false"/>

                </behavior>
            </serviceBehaviors>
            <endpointBehaviors>
                <behavior name="web">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
        </behaviors>

        <services>
            <service name="WcfImageUpload.Service1"
                     behaviorConfiguration="ServiceBehaviour" >
                <host>
                    <baseAddresses>
                        <add baseAddress="http://somesite.com:5555/Service1/" />
                    </baseAddresses>
                </host>
                <endpoint name="Service1"
                          address=""
                          binding="webHttpBinding"
                          contract="WcfImageUpload.IService1" 
                          behaviorConfiguration="web"/>

                <endpoint name="LoginServiceMex"
                          address="mex"
                          binding="mexHttpBinding"
                          contract="IMetadataExchange" />
            </service>
        </services>
    </system.serviceModel>
</configuration>

バインディングを追加する必要があります

<bindings>
  <webHttpBinding>
    <binding name="WebHttpEndpointBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows"/>
      </security>
    </binding>
  </webHttpBinding>
</bindings>

どこに追加する必要がありますか?私は .NET と WCF の初心者です。

4

2 に答える 2

0

以下のように配置できます....

<system.serviceModel>
  <services>
   <service  name="MyService">
  <endpoint address="http://localhost/IISHostedService/MyService.svc" 
  binding="wsHttpBinding" bindingName="wshttpbind" contract="IMyService">
  <identity>
  <dns value="localhost"/>
  </identity>
  </endpoint>
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>
  </services>
  <bindings>
      <webHttpBinding>
         <binding name="WebHttpEndpointBinding">
           <security mode="TransportCredentialOnly">
             <transport clientCredentialType="Windows"/>
           </security>
         </binding>
      </webHttpBinding>
   </bindings>

</system.serviceModel>

ありがとう、ヴィシャル・パテル

于 2013-10-22T13:49:28.073 に答える
0

<system.ServiceModel>タグ内の WCF サービスの web.config にバインドを含める必要があります。

基本的な http バインディング、Web HttpBinding、wsHttpBinding など、WCF でサポートされている複数のバインディングがあります。

asmx サービスのようなサービスにアクセスする場合は、SOAP を使用する BasicHttpBinding を使用します。

WCF を RESTful にしたい場合は、WebHttpBinding を使用し、それに応じて動作を構成します。より安全な wsHttpBindlings のような他のバインディングがあります。

于 2013-10-25T16:25:16.933 に答える