我寫一個WCF應用程序使用POST從Android的接受一個文件,它拋出一個異常System.ServiceModel.ServiceActivation,我明白了什麼是從完成從鏈接: -如何將綁定添加到WCF的Config文件?
System.ServiceModel.ServiceActivationException in wcf service
以下是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中的新手。
嘗試鏈接http://msdn.microsoft.com/en-us/library/ms733932.aspx – kaushik0033
將它添加到你的配置中,** **之後** **'元素 –
的目的是什麼? – Sreekanth