簡體   English   中英

與Web服務配置堆疊在一起

[英]Stacked up with web service configuration

我目前正與即時創建的Web服務堆疊在一起。 在本地測試時,一切正常,但是當我嘗試將其部署到Web服務器時,拋出以下錯誤

嘗試向URI'...我的Web服務URI ....'請求時發生錯誤。 這可能是由於嘗試在沒有適當的跨域策略或不適合SOAP服務的策略的情況下嘗試以跨域方式訪問服務。 您可能需要聯系服務的所有者以發布跨域策略文件,並確保它允許發送與SOAP相關的HTTP標頭。 此錯誤也可能是由於在Web服務代理中使用內部類型而不使用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>

跨域政策

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

這聽起來像是您嘗試使用Silverlight從未托管的Web服務訪問它時收到的錯誤。 如果是這種情況,則需要將clientaccesspolicy.xml添加到Web應用程序文件夾中。

有關允許Silverlight應用程序進行跨域訪問的MSDN文章。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM