我正在编写一个 WCF 应用程序,用于使用 POST 接受来自 android 的文件,它会引发 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 的新手。