Get PTWin sample project to work with Click Once deployment?

Get PTWin sample project to work with Click Once deployment?

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


alancaster posted on Monday, November 26, 2007

Hello,

I am trying to get the PTWin sample project to work via Click-Once deployment on the .Net 2.0 framework.

I downloaded version 2.1.4 of the CSLA Framework, unzipped and compiled the projects on my machine.  I attached the Security and PTracker DBs to my local SQL 2005 DB, changed the connection strings to point to the SQL 2005 DB and everything works fine in VS.Net.  I changed the config file in PTWin to use remoting through the RemotingHost and removed the DB connection string keys and that works fine too.  So far so good.

Now all I want to see work is the PTWin project via Click Once deployment.  I created a virtual folder in IIS to hold deployed Click Once apps and VS 2008 publishes the files there just fine, but when I click on the Run button to download and run the app via Click Once on my local machine I get the following error:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   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.Form.ShowDialog(IWin32Window owner)
   at PTWin.MainForm.DoLogin()
   at PTWin.MainForm.MainForm_Load(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
PTWin
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase:
file:///C:/Documents%20and%20Settings/Alex/Local%20Settings/Apps/2.0/BH27VLRG.DHK/52EHXY2L.9LX/ptwi..tion_54c8d0f60adfe8a2_0001.0000_15a6ac43956fc11d/PTWin.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Csla
    Assembly Version: 2.1.4.0
    Win32 Version: 1.0.0.0
    CodeBase:
file:///C:/Documents%20and%20Settings/Alex/Local%20Settings/Apps/2.0/BH27VLRG.DHK/52EHXY2L.9LX/ptwi..tion_54c8d0f60adfe8a2_0001.0000_15a6ac43956fc11d/Csla.DLL
----------------------------------------
ProjectTracker.Library
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase:
file:///C:/Documents%20and%20Settings/Alex/Local%20Settings/Apps/2.0/BH27VLRG.DHK/52EHXY2L.9LX/ptwi..tion_54c8d0f60adfe8a2_0001.0000_15a6ac43956fc11d/ProjectTracker.Library.DLL
----------------------------------------
System.Web
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase:
file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


Does anyone know how to fix this and make PTWin run via Click Once deployment?

I would like to be able to deliver a CSLA smart client win app via Click Once deployment that uses a RemotingHost for all the business objects, so the only way the smart client gets its data is through the RemotingHost data portal.

Thank You.

Alex

RockfordLhotka replied on Monday, November 26, 2007

When you published your app from VS did you make sure to set its security requirements? I think ClickOnce defaults to a pretty low level of security, but Remoting requires FullTrust (and so does CSLA .NET).

If you set that when publishing, then the user (on first install) is notified that the app wants elevated permissions and they need to accept that this is OK. After that, all should be well on the .NET permission front.

alancaster replied on Monday, November 26, 2007

Hi Rocky,

In VS.Net 2008 when you right-click properties of the PTWin project, on the Security Tab, the “Enable ClickOnce Security Settings” is checked and the “This is a full trust application” is selected.  On the Publish Tab, for prerequisites the “.Net Framework 2.0 (x86)” is checked and the “Windows Installer 3.1” is checked.  The RemotingHost is the only thing that needs to talk to SQL Server so I removed the DB connection strings from PTWin project and I unchecked the box for “SQL Server 2005 Express Edition” under prerequisites in the PTWin project.

 

When I publish the PTWin app to the virtual directory and try to launch it via the web browser however, I get the error “System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

 

I don’t see any other obvious security settings for Click-Once deployment that I can set.  Have you tried this on your own workstation yet and got it to work?  Perhaps there is something else the PTWin app is doing that is causing the AccessVioliationException error?

 

My goal is to be able to have a windows smart client app that uses CSLA 2.x and the RemotingHost for the data portal, and is easily updated and deployed via the Click-Once feature included in .Net 2.x.  At my work we are still using CSLA 1.x and .Net Framework 1.x with NetRun as the mechanism for deploying our smart client apps.  In order to move to CSLA 2.x we need to be able to use Click-Once deployment because there is no more NetRun in CSLA 2.x

 

Thank You.

 

alancaster replied on Thursday, January 17, 2008

Hi Rocky,

I ended up opening a ticket with Microsoft MSDN Support over this and it took 4 week to find the root cause of this problem.  It turns out the Kensington Expert Mouse driver interferes with launching ClickOnce applications because the mouse driver only allows 128 characters in it's path to launch apps, and the ClickOnce folder structure on the client is often longer than 128 characters.

As soon as I rolled back my mouse driver to the standard Windows mouse driver, all my ClickOnce apps worked perfectly, including the PTracker.

So, the moral of the story is beware the Kensington Expert Mouse driver, for it will render all your ClickOnce apps inoperable.  I wrote a letter to Kensington about this so I will have to wait and see what they say.

Thanks.

Alex

RockfordLhotka replied on Thursday, January 17, 2008

That is simply amazing!!

alancaster replied on Saturday, January 10, 2009

Hi Rocky,

 

I got your new CSLA 2008 book the other day and it looks great.  It is one of the main programming books I want to read this year.

 

I just wanted to thank you for making such a great framework, and documenting it so well with your books and CodeSmith templates.  Your framework solves a lot of common & tricky problems for business application development, and the fact that it is open source is really awesome.

 

I hope you have a fun and productive 2009.

 

Thanks again.

 

Alex Lancaster

IEEE Sr. Member

Computer Society

 

Copyright (c) Marimer LLC