Click here to Skip to main content
15,878,003 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I am using ajax enabled wcf and deployed it on iis8. when i access the service from localhost the required result displayed

{"GetInsuranceResult":[{"ItemID":6,"ItemName":"Adam Insur ( Nov 19
2012  6:11PM )"},{"ItemID":7,"ItemName":"State Life ( Nov 19 2012  6:12PM )"},{"ItemID":8,"ItemName":"Jublie Ins ( Nov 19 2012  2:36PM
)"},{"ItemID":10,"ItemName":"State Life ( Mar  5 2013  3:26PM
)"},{"ItemID":13,"ItemName":"medicare ( Mar 25 2013  3:43PM
)"},{"ItemID":14,"ItemName":"medicate ( Mar 25 2013  3:44PM )"}]}


but when i access the service from client(through ip address) the result is different.

 {"GetInsuranceResult":[{"ItemID":7,"ItemName":"State Life2-edit ( Nov
 19 2012  6:12PM )"},{"ItemID":8,"ItemName":"Jublie Insurance Com ( Nov
 19 2012  2:36PM )"},{"ItemID":10,"ItemName":"State Life -3 ( Mar  5
 2013  3:26PM )"},{"ItemID":14,"ItemName":"medicate ( Mar 25 2013 
3:44PM )"},{"ItemID":15,"ItemName":"test ( Mar 27 2013  3:24AM
)"},{"ItemID":16,"ItemName":"new test ( Mar 27 2013  6:31AM )"}]}



And WCF web.config

<system.serviceModel>
    <bindings>
      <webHttpBinding>

        <binding crossDomainScriptAccessEnabled="true" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="524288"
                 transferMode="Buffered">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
                      maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"  />


        </binding>

      </webHttpBinding>
    </bindings>
    <standardEndpoints>
      <webScriptEndpoint>
        <standardEndpoint name="" crossDomainScriptAccessEnabled="true" />
      </webScriptEndpoint>
    </standardEndpoints>
    <services>
      <service name="PHRWCFService.Service1"  behaviorConfiguration="ServBehave">
        <!--Endpoint for SOAP-->
        <endpoint
           address="soapService"
            binding="webHttpBinding"
           behaviorConfiguration="restPoxBehavior"
            contract="PHRWCFService.IService1"/>
        <!--Endpoint for REST-->
        <endpoint
          address="XMLService"
           binding="webHttpBinding"
           behaviorConfiguration="restPoxBehavior"
           contract="PHRWCFService.IService1"/>
      </service>
    </services>
    <behaviors>

      <serviceBehaviors>
        <behavior name="ServBehave">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>

        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <!--Behavior for the REST endpoint for Help enability-->
        <behavior name="restPoxBehavior">
          <webHttp helpEnabled="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

  </system.serviceModel>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483647" maxUrl="4294967295" maxQueryString="4294967295" />
      </requestFiltering>
    </security>
    <directoryBrowse enabled="true" />
    <modules runAllManagedModulesForAllRequests="true" />
    <httpProtocol>
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>


Can any one tell me why this problem occurred.

Thanks.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900