С накоплением конфигурации веб-службы - PullRequest
1 голос
/ 28 ноября 2011

В настоящее время я работаю с веб-сервисом, который я создаю прямо сейчас. при локальном тестировании все работает нормально, но когда я пытаюсь развернуть его на веб-сервере, выдается следующая ошибка

Произошла ошибка при попытке сделать запрос к URI «... URI моего веб-сервиса здесь ....». Это может быть связано с попыткой доступа к сервису междоменным способом без надлежащей междоменной политики или с политикой, которая не подходит для служб SOAP. Вам может потребоваться связаться с владельцем сервиса, чтобы опубликовать файл междоменной политики и убедиться, что он позволяет отправлять HTTP-заголовки, связанные с SOAP. Эта ошибка также может быть вызвана использованием внутренних типов в прокси-сервере веб-службы без использования атрибута InternalsVisibleToAttribute. Пожалуйста, смотрите внутреннее исключение для более подробной информации.

вот мой веб-конфиг.

<?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>

Клиентская политика доступа

 <?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

 <?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>

1 Ответ

1 голос
/ 28 ноября 2011

Это похоже на ошибку, которую вы получаете, когда пытаетесь использовать silverlight для доступа к веб-сервису, из которого он не размещен. В этом случае вам нужно добавить clientaccesspolicy.xml в папку вашего веб-приложения.

MSDN статья о разрешении междоменного доступа для приложения silverlight.

...