C# WCF ChannelFactory BadRequest 400 Error -


i have created simple webservice server, call methods service class in same project i've created webchannelfactory proxy. it's working fine until move project(or exe version) machine. can't figure out what's going on!

i'm getting error message:

the remote server returned unexpected response: (400) bad request. 

with stacktrace:

server stack trace:    @ system.servicemodel.channels.httpchannelutilities.validaterequestreplyresp onse(httpwebrequest request, httpwebresponse response, httpchannelfactory factor y, webexception responseexception, channelbinding channelbinding)    @ system.servicemodel.channels.httpchannelfactory.httprequestchannel.httpcha nnelrequest.waitforreply(timespan timeout)    @ system.servicemodel.channels.requestchannel.request(message message, times pan timeout)    @ system.servicemodel.dispatcher.requestchannelbinder.request(message messag e, timespan timeout)    @ system.servicemodel.channels.servicechannel.call(string action, boolean on eway, proxyoperationruntime operation, object[] ins, object[] outs, timespan tim eout)    @ system.servicemodel.channels.servicechannelproxy.invokeservice(imethodcall message methodcall, proxyoperationruntime operation)    @ system.servicemodel.channels.servicechannelproxy.invoke(imessage message) exception rethrown @ [0]:    @ system.runtime.remoting.proxies.realproxy.handlereturnmessage(imessage req msg, imessage retmsg)    @ system.runtime.remoting.proxies.realproxy.privateinvoke(messagedata& msgda ta, int32 type)    @ client.iclientservice.dosomething()    @ host.clienthost.start(uri hosturi, int32 interval) in c:\(...) 

code:

webchannelfactory<client.iclientservice> factory = new webchannelfactory<client.iclientservice>(hosturi);  client.iclientservice proxy = factory.createchannel();  proxy.dosomething();  // error shout here on machine2 

thanks in advance

edit1: example, there's no client-side(i've named client server). said, code it's working no errors in machine(both using localhost).

<?xml version="1.0"?> <configuration>       <appsettings>       <system.servicemodel>         <bindings>         </bindings>     <services>       <service name="client.clientservice" behaviorconfiguration="default">         <endpoint address="" binding="webhttpbinding" contract="client.iclientservice"></endpoint>       </service>     </services>     <behaviors>       <servicebehaviors>         <behavior name="default">           <servicemetadata httpgetenabled="true"></servicemetadata>         </behavior>       </servicebehaviors>     </behaviors>   </system.servicemodel>   <startup>     <supportedruntime version="v4.0" sku=".netframework,version=v4.0"/>   </startup> </configuration> 

edit2:

on browser, got this:

the server encountered error processing request. exception message 'the type initializer 'client.clientservice' threw exception.'. see server logs more details. exception stack trace is:

at client.clientservice..ctor() @ createclient.clientservice() @ system.servicemodel.dispatcher.instanceprovider.getinstance(instancecontext instancecontext, message message) @ system.servicemodel.dispatcher.instancebehavior.getinstance(instancecontext instancecontext, message request) @ system.servicemodel.instancecontext.getserviceinstance(message message) @ system.servicemodel.dispatcher.instancebehavior.ensureserviceinstance(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage41(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage4(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage31(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage3(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage2(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage11(messagerpc& rpc) @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage1(messagerpc& rpc) @ system.servicemodel.dispatcher.messagerpc.process(boolean isoperationcontextset)

problem solved.

the service make use of database, when copy project new machine forgot create new database.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -