DJay
DJay

Reputation: 2567

Unexpected Error message from WCF service

I have one wcf webservice deployed on server. In case of an exception the error message behaves like code is getting executed from local machine. For example the below error message indicates the local machine folder where actual code is stored. for example "C:\initpub...". Why i am getting this error on server. Any suggestion?

Message: Object reference not set to an instance of an object.
Trace:
Server stack trace:
at
System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Domain.ExternalAccount.ExternalAccount.InsertExternalAccountWithPositions(ExternalAccountWithPositionsInParam request)
at Domain.ExternalAccount.ExternalAccountClient.InsertExternalAccountWithPositions(ExternalAccountWithPositionsInParam request) in
C:\Inetpub\wwwroot\Site\Secure\finplanextsvc\NaviplanExternalServices\Domain\ExternalAccount.cs:line 3145
at NaviplanExternalServices.NaviplanExternalAccount.InsertExternalAccount(AccountType acctType, ExternalPosition[] positions) in
C:\Inetpub\wwwroot\Site\Secure\finplanextsvc\NaviplanExternalServices\NaviplanExternalServices\Services\NaviplanExternalAccount.svc.cs:line 178

Upvotes: 1

Views: 222

Answers (2)

Anders Abel
Anders Abel

Reputation: 69280

The source file location is compiled into the .pdb when you build the project. It always refers to the source path from where it was built.

Upvotes: 1

CodingWithSpike
CodingWithSpike

Reputation: 43738

The original source path and line number are stored in the .pdb file that is built along with your application. If you also deploy the .pdb with your .dll, then you get these in your stack traces. That is the default .net behavior, and is actually makes throwing an exception slower to execute if you have the .pdb in the deploy directory next to the .dll or .exe. You can remove that detail from the error message by not deploying, or deleting the .pdb file.

Upvotes: 2

Related Questions