我试图从我的 Silverlight 应用程序中访问一个自托管的 WCF 服务,但它不工作。该服务被配置为使用 SSL,我可以使用 WCFTestClient 工具、一个 Web 浏览器来访问它,我可以引用该服务并从 silverlight 项目中更新它。问题是当 silverlight 应用程序尝试调用服务时,它会出现以下错误:
服务器没有提供有意义的回复;这可能是由于合同不匹配、会话过早关闭或内部服务器错误造成的。
当我使用 WCF 测试客户端工具点击它时,它返回的数据没有问题(如预期的那样)。
有任何想法吗?
以下是我的应用程序配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="6553600" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="Transport">
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="webHttp" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="6553600" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="Application.ServiceModel.ApplicationService" behaviorConfiguration="serviceBehavior">
<host>
<baseAddresses>
<add baseAddress="https://192.168.1.171:8000/ApplicationServiceModel/service"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="basicHttp"
contract="Application.ServiceModel.IApplicationService" />
<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange"/>
<endpoint address="http://localhost:8000/"
binding="webHttpBinding"
contract="Application.ServiceModel.IApplicationService"
behaviorConfiguration="webHttpBehavior" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webHttpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>