我有一個Silverlight應用程序,它有一個WCF。當wcf被調用時失敗,出現以下異常:Silverlight + WCF通信異常
An error occurred while trying to make a request to URI 'http://localhost:4693/MapService.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details.
silverlight和WCF都從本地運行。
我的Silverlight是運行:
...\SilverlightApplication1\SilverlightApplication1\Bin\Release\SilverlightApplication1TestPage.html
這是WCF的web.config服務標籤:
<services>
<service behaviorConfiguration="FileUpAndDownload.Web.MapServiceBehavior" name="FileUpAndDownload.Web.MapService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="MapBinding" contract="FileUpAndDownload.Web.IMapService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
,這是ServiceReference.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMapService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:4693/MapService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IMapService" contract="MapService.IMapService"
name="BasicHttpBinding_IMapService" />
</client>
</system.serviceModel>
我已將clientaccesspolicy.xml放在bin \ release中,但沒有幫助。
幫助請!
我的電腦上沒有IIS – gln 2011-02-15 10:45:20