c# - WCF Service converts localhost to www.localhost.com only in case of json response -


i have created simple wcf service have 3 methods. each ov these methods works in case of single [webget] attribute, if add (responseformat = webmessageformat.json), converting localhost www.localhost.com address.

here's config:

<?xml version="1.0"?> <configuration>   <appsettings/>   <system.web>     <compilation debug="true" targetframework="4.0"/>     <httpruntime/>   </system.web>   <system.servicemodel>     <behaviors>       <servicebehaviors>         <behavior>           <servicemetadata httpgetenabled="true" httpsgetenabled="false"/>           <servicedebug includeexceptiondetailinfaults="true"/>           <userequestheadersformetadataaddress />         </behavior>       </servicebehaviors>     </behaviors>     <protocolmapping>       <add binding="basichttpsbinding" scheme="https"/>     </protocolmapping>     <services>       <service name="promocenyparseservice.promocenyparseservice">       <endpoint kind="webhttpendpoint"        contract="promocenyparseservice.ipromocenyparseservice" />       </service>     </services>   </system.servicemodel>   <system.webserver>     <modules runallmanagedmodulesforallrequests="true"/>     <directorybrowse enabled="true"/>   </system.webserver> </configuration> 

and here's service interface:

[servicecontract] public interface ipromocenyparseservice {     [operationcontract]     [webget(responseformat = webmessageformat.json)]     product parseitem(string url);      [operationcontract]     [webget(responseformat = webmessageformat.json)]     list<product> parsepage(string urlpage);      [operationcontract]     [webget(responseformat = webmessageformat.json)]     int getnumofpages(string urlpage); } 

could please tell doing wrong?

update:

endpoint added, no results. still working on xml, not working on json

update 2:

i have discovered problem exists functions:

parseitem 

and

parsepage 

this function returns normal value.

i have tried various endpoint configurations etc.

where problem?

update 3:

i have discovered, happens when function returns object datacontract.

i have found issue.

problem exists in datetime object exists in datacontract. supose there different time zone or different default date format onmy server.

resolution of problem:

[datamember] public datetime discountstart {     { return this._discountstart.touniversaltime(); }     set { this._discountstart = value; } } 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -