0

我正在接受The maximum string content length quota (8192) has been exceeded while reading XML data.ajax POST 调用。

我添加并bindingConfiguration="UsernameWithTransport"在之后添加了异常。<endpoint><readerQuotas>Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http]

请参阅下面的我的 web.config 文件。

<system.serviceModel>
<behaviors>
  <serviceBehaviors>   
      <behavior name="metadataBehavior">
          <serviceMetadata  httpGetEnabled="true" httpGetUrl="" httpsGetEnabled="false"/>            
          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
      </behavior>
  </serviceBehaviors>
  <endpointBehaviors>
    <behavior name="Company.CostReduction.EditInitiativesAspNetAjaxBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
  <service name="Company.CostReduction.EditInitiatives" behaviorConfiguration="metadataBehavior">
      <host>
          <baseAddresses>
              <add baseAddress="http://localhost:57771/EditInitiatives.svc" />
          </baseAddresses>
      </host>
      <endpoint address="" behaviorConfiguration="Company.CostReduction.EditInitiativesAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="UsernameWithTransport" contract="Company.CostReduction.EditInitiatives"  />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<bindings>
  <webHttpBinding>
    <binding name="UsernameWithTransport">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      <security mode="Transport">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>
  </webHttpBinding>
</bindings>

这里有什么问题?

4

1 回答 1

0

The problems start here

  <host>
      <baseAddresses>
          <add baseAddress="http://localhost:57771/EditInitiatives.svc" />
      </baseAddresses>
  </host>

You have selected security mode as "Transport" in your webHttpBinding configuration. But your base address is http. It should be https. (You cannot host a https service with development server by the way, you need to host it in IIS.) Change your base address to something like this: https://localhost:57771/EditInitiatives.svc

problem continues here:

 <behavior name="metadataBehavior">
      <serviceMetadata  httpGetEnabled="true" httpGetUrl="" httpsGetEnabled="false"/>            
      <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
  </behavior>

you are gonna host your service with Transport security. Sou you need to set httpGetEnabled to false and httpsGetEnabled to true. Which is the opposite setting of the current configuration.

and finally to host your metadata with transport security you will need to change here as well:

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

should be changed to:

<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />

Try these changes and post any more errors you are getting here.

Hope this helps!

于 2013-05-22T14:38:27.040 回答