Allan Chua
Allan Chua

Reputation: 10185

Stacked up with web service configuration

I'm currently stacked with the web service that im creating right now. when Testing it in local it all works fine but when I try to deploy it to the web server it throws me the following error

An error occurred while trying to make a request to URI '...my web service URI here....'. 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.

here is my web config.

<?xml version="1.0"?>
<configuration>
  <configSections>
  </configSections>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
    </modules>
    <validation validateIntegratedModeConfiguration="false" />
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2000000000" />
      </requestFiltering>
    </security>
  </system.webServer>
  <connectionStrings>
    <add name="........" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <!-- Testing -->
    <add key="DataConnectionString" value="..........." />
   </appSettings>
   <system.web>
     <compilation debug="true" targetFramework="4.0">
       <buildProviders>
         <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
       </buildProviders>
     </compilation>
     <httpRuntime executionTimeout="1200" maxRequestLength="2000000" />
   </system.web>
   <system.serviceModel>
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
     <behaviors>
       <serviceBehaviors>
         <behavior name="Service1">
           <serviceMetadata httpGetEnabled="true" />
           <serviceDebug includeExceptionDetailInFaults="true" />
           <dataContractSerializer maxItemsInObjectGraph="2000000000" />
         </behavior>
         <behavior name="">
           <serviceMetadata httpGetEnabled="true" />
           <serviceDebug includeExceptionDetailInFaults="false" />
         </behavior>
         <behavior name="nextSPOTServiceBehavior">
           <serviceMetadata httpsGetEnabled="true"/>
           <serviceDebug includeExceptionDetailInFaults="true" />
           <dataContractSerializer maxItemsInObjectGraph="2000000000" />
         </behavior>
       </serviceBehaviors>
     </behaviors>
     <bindings>
       <basicHttpBinding>
         <binding name="SecureBasic" closeTimeout="00:10:00"
              openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
              maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
           <security mode="Transport" />
           <readerQuotas maxArrayLength="2000000" maxStringContentLength="2000000"/>
         </binding>
         <binding name="BasicHttpBinding_IDownloadManagerService" closeTimeout="00:10:00"
            openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
            maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
           <security mode="Transport" />
         </binding>
       </basicHttpBinding>
     </bindings>
     <services>   
       <service behaviorConfiguration="nextSPOTServiceBehavior" name="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.DownloadManagerService">
         <endpoint binding="basicHttpBinding" bindingConfiguration="SecureBasic" name="basicHttpSecure" contract="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.IDownloadManagerService" />
         <!--<endpoint binding="basicHttpBinding" bindingConfiguration="" name="basicHttp" contract="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.IDownloadManagerService" />-->
         <!--<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDownloadManagerService" contract="NextSPOTDownloadManagerWebServiceTester.Web.WebServices.IDownloadManagerService" />
         <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />-->
       </service>
     </services >
   </system.serviceModel>
 </configuration>

Client access Policy

 <?xml version="1.0" encoding="utf-8" ?>
 <access-policy>
   <cross-domain-access>
     <policy>
       <allow-from http-request-headers="*">
         <domain uri="http://*"/>
         <domain uri="https://*"/>
       </allow-from>
       <grant-to>
         <resource path="/" include-subpaths="true"/>
       </grant-to>
     </policy>
   </cross-domain-access>
 </access-policy>

CROSS Domain policy

 <?xml version="1.0"?>
 <!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-     policy.dtd">
 <cross-domain-policy>
   <allow-http-request-headers-from domain="*" headers="*"/>
 </cross-domain-policy>

Upvotes: 1

Views: 280

Answers (1)

Todd Richardson
Todd Richardson

Reputation: 1129

This sounds like the error you get when you are trying to use silverlight to access a webservice from where it is not hosted. If this is the case you need to add a clientaccesspolicy.xml to your web application folder.

MSDN article on allowing crossdomain access for a silverlight application.

Upvotes: 1

Related Questions