Authentication in WCF from .NET

​Hi Techno Babler

​No offense to your programmer but if they had gone through the guide ​
Â
​their code would look more like this... I Highly recommend they follow the guide and they will have better success :-)

ABCCodeSvcContractClient abcCodeClient = GetClient< ABCCodeSvcContractClient
, ABCCodeSvcContract>(
builder.Uri.ToString(),
epicorUserID,
epiorUserPassword,
bindingType);

​

​



Jose C Gomez
Software Engineer


T: 904.469.1524 mobile

Quis custodiet ipsos custodes?
They have gone through the TechRefGuide_WCFServices_100700.pdf to make sure the web.config is setup correctly.

Any ideas or anything jump out at anyone? Currently trying to connect to as Demo DB,

I have a programmer trying to create a connection, this is their current code.

 CustShipSvcContractClient proxy = new CustShipSvcContractClient();

           proxy.ClientCredentials.UserName.UserName = "epicor";

           proxy.ClientCredentials.UserName.Password = "epicor";

           bool errorOccurred;

           CustShipTableset custShip = proxy.GetRows(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,

                string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,

                string.Empty, string.Empty, string.Empty, 0, 1, out errorOccurred)

Â



The problem is currently that they fail authentication and get this error message.



System.ServiceModel.Security.SecurityAccessDeniedException was unhandled

 HResult=-2146233087

 Message=Access is denied.

 Source=mscorlib

 StackTrace:

  Server stack trace:Â

    at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)

    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

  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 TestService.CustShipSvc.CustShipSvcContract.GetRows(GetRowsRequest request)

    at TestService.CustShipSvc.CustShipSvcContractClient.TestService.CustShipSvc.CustShipSvcContract.GetRows(GetRowsRequest request) in c:\Visual Studio 2012\Projects\TestService\TestService\Service References\CustShipSvc\Reference.cs:line 38689

    at TestService.CustShipSvc.CustShipSvcContractClient.GetRows(String whereClauseShipHead, String whereClauseShipHeadAttch, String whereClauseCartonTrkDtl, String whereClauseShipDtl, String whereClauseShipDtlAttch, String whereClauseShipCOO, String whereClauseShipDtlPackaging, String whereClauseShipDtlTax, String whereClauseShipMisc, String whereClauseReplicatedPacks, String whereClauseShipUPS, String whereClauseLegalNumberGenerate, String whereClauseSalesKitCompIssue, String whereClauseSelectedSerialNumbers, String whereClauseShipTaxSum, String whereClauseSNFormat, Int32 pageSize, Int32 absolutePage, Boolean& morePages) in c:\Visual Studio 2012\Projects\TestService\TestService\Service References\CustShipSvc\Reference.cs:line 38731

    at TestService.Form1.button1_Click(Object sender, EventArgs e) in c:\Visual Studio 2012\Projects\TestService\TestService\Form1.cs:line 27

    at System.Windows.Forms.Control.OnClick(EventArgs e)

    at System.Windows.Forms.Button.OnClick(EventArgs e)

    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

    at System.Windows.Forms.Control.WndProc(Message& m)

    at System.Windows.Forms.ButtonBase.WndProc(Message& m)

    at System.Windows.Forms.Button.WndProc(Message& m)

    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

    at System.Windows.Forms.Application.Run(Form mainForm)

    at TestService.Program.Main() in c:\Visual Studio 2012\Projects\TestService\TestService\Program.cs:line 19

    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

    at System.Threading.ThreadHelper.ThreadStart()

 InnerException:Â