I have a WCF Service that I've added to a Silverlight project and is now hosting in Visual Studio's ASP.NET Dev Server. But tyring to run it I get the following error:
System.ServiceModel.CommunicationException was unhandled by user code Message="An error occurred while trying to make a request to URI 'http://localhost:51547/WCFService1/Service.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." StackTrace: at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at niki_lanik_latestnews.WCFXmlOps.IxmlLoadClient.IxmlLoadClientChannel.EndLoadArticleFromXML(IAsyncResult result) at niki_lanik_latestnews.WCFXmlOps.IxmlLoadClient.niki_lanik_latestnews.WCFXmlOps.IxmlLoad.EndLoadArticleFromXML(IAsyncResult result) at niki_lanik_latestnews.WCFXmlOps.IxmlLoadClient.OnEndLoadArticleFromXML(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) InnerException: System.Security.SecurityException Message="" StackTrace: at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) InnerException: System.Security.SecurityException Message="Security error." StackTrace: at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.c__DisplayClass5.b__4(Object sendState) at System.Net.Browser.AsyncHelper.c__DisplayClass2.b__0(Object sendState) InnerException:
It's not hosted cross domain as it's in the same project, so I'm not sure what is causing this? Any ideas anyone?
Tony
UPDATE
Below is my binding config in web.config:
<bindings>
<basicHttpBinding>
<binding name="basicHTTP"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
closeTimeout="00:10:00"
openTimeout="00:03:00"
maxBufferSize="100000"
maxReceivedMessageSize="100000"
transferMode="StreamedResponse">
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="mexBehavior" name="LoadXMLService.XMLOperations">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="basicHTTP"
contract="LoadXMLService.IxmlLoad" />
</service>
</services>
Please remember this service is supposed download & upload files to the Silerlight 3 project.