Click here to Skip to main content
15,921,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a c# web application/projct which is working well. Later I added a wcf service as new item to this proj. Then I add a new simple Console application to this solution to consume the wcf. It works fine in my local. (My local server name is A. Using http://A/MyProjName/wcfSendRpt.svc OR http://localhost/MyProjName/wcfSendRpt.svc both Okay).

Then I published my web application( with the wcf service) to live server B. (B just host this only web-application. ) Both http://B/wcfSendRpt.svc OR http://localhost/wcfSendRpt.svc works fine.
Then I deployed my Console application to server B. ( I just copyed the exe and config files to sever B). I changed the endpoint address in config file from "http://A/MyProjName/wcfSendRpt.svc" to "http://B/wcfSendRpt.svc" like below
<endpoint address="http://B/wcfSendRpt.svc" 
	binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IwcfSendRpt"
        contract="nsSendRpt.IwcfSendRpt" name="BasicHttpBinding_IwcfSendRpt" /> 

But it doesn't work. The error from event view is like below,
 Unhandled Exception: System.ServiceModel.FaultException`1[System.ServiceModel.Ex
ceptionDetail]: An error occurred while executing the command definition. See th
e inner exception for details.

Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message
 reply, MessageFault fault, String action, MessageVersion version, FaultConverte
r faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRunt
ime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on
eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall
Message methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
   at CAScheduledService.nsSendRpt.IwcfSendRpt.SendRpt(String statementdate)
   at CAScheduledService.Program.Main(String[] args)

My console application is very simple: the code is like below
class Program
        static void Main(string[] args)
            nsSendRpt.IwcfSendRptClient ss = new IwcfSendRptClient();
            string a = ss.SendRpt(System.DateTime.Now.ToString("yyyyMMdd"));

I need your help to solve this. And I am pretty new in wcf. Is this wcf service in my web application is restful?

Thanks a lot
Updated 6-Feb-13 4:31am
Jameel VM 5-Feb-13 13:36pm    
what's the error showing when browsing the url in server?
Sergey Alexandrovich Kryukov 5-Feb-13 13:40pm    
"It does not work" is not informative.
Richard C Bishop 5-Feb-13 14:07pm    
While your problem is not described well, I still want to ask if you have an SVC File in the folder where your application files live on the live B server?
lmik9898 5-Feb-13 16:44pm    
.svc file is in the web folder. in the console appl, just have the exe and config files
thatraja 5-Feb-13 14:31pm    
error message?

1 solution

After all, I figured it by myself. The problem is that there is table's column name different from the live one. But without tracing I can't find the problem. So I add this to config file
      <source name="System.ServiceModel">
              switchValue="Information, ActivityTracing"
              propagateActivity="true" >
             <add name="xml" />
      <source name="System.ServiceModel.MessageLogging">
            <add name="xml" />
      <source name="myUserTraceSource">
              switchValue="Information, ActivityTracing">
            <add name="xml" />
        <add name="xml">
             initializeData="Error.svclog" />
Share this answer

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