PTTracker throws exception if PTServiceClient is start up app

PTTracker throws exception if PTServiceClient is start up app

Old forum URL: forums.lhotka.net/forums/t/1668.aspx


dlaub posted on Thursday, November 02, 2006

PTTracker runs fine if I stay with the default start up project PTWin.  But when I switch to PTServiceClient as the startup project, I get the following exception imemdiately:

I'm running Windows XP SP2, CSLA Version 2.1 c# version & VSTS (2005)

Thanks in advance

System.Web.Services.Protocols.SoapException was unhandled
  Message="System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Invalid token for impersonation - it cannot be duplicated.\n   at System.Security.Principal.WindowsIdentity.CreateFromToken(IntPtr userToken)\n   at System.Security.Principal.WindowsIdentity..ctor(SerializationInfo info)\n   at System.Security.Principal.WindowsIdentity..ctor(SerializationInfo info, StreamingContext context)\n   --- End of inner exception stack trace ---\n   at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)\n   at System.RuntimeMethodHandle.SerializationInvoke(Object target, SignatureStruct declaringTypeSig, SerializationInfo info, StreamingContext context)\n   at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)\n   at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)\n   at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)\n   at System.Runtime.Serialization.ObjectManager.DoFixups()\n   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)\n   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)\n   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)\n   at Csla.Server.Hosts.WebServicePortal.Deserialize(Byte[] obj) in C:\\ExpertBizObjs\\csla20cs\\csla20cs\\Csla\\DataPortal\\Hosts\\WebServicePortal.cs:line 274\n   at Csla.Server.Hosts.WebServicePortal.Fetch(Byte[] requestData) in C:\\ExpertBizObjs\\csla20cs\\csla20cs\\Csla\\DataPortal\\Hosts\\WebServicePortal.cs:line 190\n   --- End of inner exception stack trace ---\n   at PTService.GetProjectList() in c:\\ExpertBizObjs\\csla20cs\\ProjectTracker20cs\\www\\PTWebService\\App_Code\\PTService.cs:line 49\n   --- End of inner exception stack trace ---"
  Source="System.Web.Services"
  Actor=""
  Lang=""
  Node=""
  Role=""
  StackTrace:
       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at PTServiceClient.PTService.PTService.GetProjectList() in C:\ExpertBizObjs\csla20cs\ProjectTracker20cs\PTServiceClient\Web References\PTService\Reference.cs:line 129
       at PTServiceClient.MainForm.MainForm_Load(Object sender, EventArgs e) in C:\ExpertBizObjs\csla20cs\ProjectTracker20cs\PTServiceClient\MainForm.cs:line 23
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.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.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       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 PTServiceClient.Program.Main() in C:\ExpertBizObjs\csla20cs\ProjectTracker20cs\PTServiceClient\Program.cs:line 17
       at System.AppDomain.nExecuteAssembly(Assembly 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.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

guyroch replied on Thursday, November 02, 2006

Not sure is this applies when using the PTServiceClient but I had a similar problem a while back when using Remoting. 

I had both the .Net framework 1.1 and 2.0 installed on my remoting server and the virtual directory I created to _host_ remoting pointed to the 1.1 framework instead of the 2.0 framework.  When you create a virtual directory in IIS, the default will point to the 1.1 framework.  I had to manually set it to use the 2.0 framework - and that was it :)

Again, I might totally be in the left field here when using PTServiceClient.

 

dlaub replied on Thursday, November 02, 2006

I'm running everything on one PC and I haven't created an Virtual directories for IIS - is this relevant because the PTTRacker app is running ASP.net  development server instead of IIS.  I do have both 1.1 & 2.0 frameworks installed but not sure how this is relevant.  Thanks for trying to help, but I'm still stuck!

Bayu replied on Thursday, November 02, 2006

To me it merely looks like the well-known Identiy/Principal issue ..... when looking at the stack-trace I see things like WindowsIdentity .. I believe this should have been PTIdentity.

Could it be that your web service doesn't have the csla security configured like your remoting host does?

You say that PTracker runs fine, I assume this is with remoting turned on? In that case your remotinghost is configured properly and you could check if your webservice is similarly configured.

Hope this points you in the right direction.

Bayu

dlaub replied on Friday, November 03, 2006

Thanks - what you suggest is a good start.  I just purchased the BO book & am not expert enough yet to know which config settings shoudl be checked/changed.  Might you be able to give me an even more specific helping hand?

David

Bayu replied on Saturday, November 04, 2006

Sure,

I'll try. Wink [;)]

- Your PTServiceClient needs to be able to find your webservice, so make sure that in its app.config is points to the correct path.

Once you have run the app at least once, Visual Studio will have started several 'ASP.Net Development Servers', one of them hosts your webservice. An icon for this will appear in your system tray. You can click it and verify the path and port-number. When you stop debugging, these servers will keep running, so the port-number etc. will remain valid.

- Your PTWebService in turn communicates to your DB via remoting. So make sure that in its web.config it points to the right remotinghost url ('CslaDataPortalUrl'). The authentitication mode of your WebService is set to Windows, that is fine! It is 'behind' the webservice that you will use the PTPrincipal/PTIdentity. For this purpose there is a Security class, which takes care of this. You don't have to do anything with this, I mention it just for your understanding.

- You said your RemotingHost worked fine, so you wouldn't need to do anything here. Your remotinghost is the one to communicate with your DB in the end, so the connection strings should be made to match your local setup. Also it needs Csla authentication turned on (is turned on by default).


At this point I think your PTServiceClient successfully finds your WebService, but somehow there are security restrictions that disallow your PTServiceClient to actually consume the WebService.

Good luck!
Bayu

Copyright (c) Marimer LLC