Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET WCF WebService
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 27-Mar-13 4:39am

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



Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 27 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100