Errors while running ProjectTracker20vb Solutions (PTWeb).

Errors while running ProjectTracker20vb Solutions (PTWeb).

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


tarekahf posted on Wednesday, April 02, 2008

Some how, I managed to load and compile the ProjectTracker20vb and csla20vb solutions ...! Now, they are compiled without any errors.

To give you an idea, I placed the Project Parts on the DEV Machine (Windows 2003 Server SP2) and I am opening them locally from my Machine (Windows XP + VS2005). So, from VS, I opened the solution files from a Shared Folder over the network. I usually follow this method and it works. They opened and complied successfully.

Of course, I had to add the required references to the DLLs, after I got 2 errors. The DLLs that were missing from the references are:

ProjectTracker.Library.dll and Csla.dll.

I setup a virtual directory on the DEV Server Machine as per the instructions here : http://www.lhotka.net/files/csla20/BuildCsla.pdf.

I tried to run the Web Site using this URL:

http://devmachine/PTWebvb/

And WOW, it opened with the message "Welcome to the Project Tracker system". Great !

Then, I click on Login, and try to Enter User Name and Password (pm/pm) and Click Login, after that I got this error:

Could not load file or assembly 'EnterpriseServicesHostvb' or one of its dependencies. The system cannot find the file specified.

I did follow the instructions to register the EnterpriseServicesHostvb and it was registered successfully. But it looks to me that it was registered on my Local Machine.

Please help me to solve this error.

Tarek.

cliffordru replied on Wednesday, April 02, 2008

Tarek,

Can you check in the web.config to see if you have an uncommented key for CslaDataPortalProxy in the appSettings section.  You can comment this out to see if that resolves.

Also, you should check the connection string settings to determine where the sql express database is located.  There will be a .mdf and .ldf file and you need to ensure that the proper accounts have permissions to these files.

Hope that helps.

tarekahf replied on Wednesday, April 02, 2008

cliffordru:

Tarek,

Can you check in the web.config to see if you have an uncommented key for CslaDataPortalProxy in the appSettings section.  You can comment this out to see if that resolves.

Ok, I will check that when I am back at work, and will let you know the result.

Also, you should check the connection string settings to determine where the sql express database is located.  There will be a .mdf and .ldf file and you need to ensure that the proper accounts have permissions to these files.


Yes, I already followed the insturctions to update the conneciton string to .mdg and .ldf files. I put the path Local to Server Machine, ie, something like: E:\..\...

I am not sure that this is the casue of the error. It looks to me that the ASP.NET Engine is trying to locate this file/dll, and it is not found. I think I need to register this library on the server, in the same way I registered it on my Machine locally, but I do not know how ? I mean, how I can open VS Command Line on the Server, and issue this command to register this library ? Does this mean that I have to install VS2005 on the Server ?

Please help.

Tarek.

tarekahf replied on Saturday, April 05, 2008

cliffordru:

Tarek,

Can you check in the web.config to see if you have an uncommented key for CslaDataPortalProxy in the appSettings section.  You can comment this out to see if that resolves.

Also, you should check the connection string settings to determine where the sql express database is located.  There will be a .mdf and .ldf file and you need to ensure that the proper accounts have permissions to these files.

Hope that helps.

I checked the web.config, and following is the appSettings section:

<appSettings>

<add key="CslaAuthentication" value="CSLA"/>

<!--<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.RemotingProxy, Csla"/>

<add key="CslaDataPortalUrl" value="http://localhost:3134/RemotingHost/RemotingPortal.rem"/>-->

<!--<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WebServicesProxy, Csla"/>

<add key="CslaDataPortalUrl" value="http://localhost:3137/WebServicesHost/WebServicePortal.asmx"/>-->

<add key="CslaDataPortalProxy" value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostvb"/>

</appSettings>

I did ot change anything in this section.

As per my understanding from you recommendation, I will comment out the CslaDataPortalProxy, right ?

After I commented out this line

<add key="CslaDataPortalProxy" value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostvb"/>

I ran the project again, and after I login, I got this error:

Server Error in '/PTWebvb' Application.

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:

Line 109:
Line 110:      Using cn As New SqlConnection(Database.SecurityConnection)
Line 111:        cn.Open()
Line 112:        Using cm As SqlCommand = cn.CreateCommand
Line 113:          cm.CommandText = "Login"

Please help !

Tarek.

tarekahf replied on Saturday, April 05, 2008

OK, you can say CONGRATULATIONS to me !

I solved the problem.

I think this is becuase SQL Server Express was not activated on the DEV Machine. So, I attached the PTracker and PTSecurity Database to SQL Server 2005 Engine, and changed the connection strings in web.config accordingly, and everything worked successfully.

So far, I only test the Web Client Version.

Can some one explain to me what all these proxy thing settings are for, in "appSettings" in web.config ? Can you give me a link to understand more about them ?

<appSettings>

<add key="CslaAuthentication" value="CSLA"/>

<!--<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.RemotingProxy, Csla"/>

<add key="CslaDataPortalUrl" value="http://localhost:3134/RemotingHost/RemotingPortal.rem"/>-->

<!--<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WebServicesProxy, Csla"/>

<add key="CslaDataPortalUrl" value="http://localhost:3137/WebServicesHost/WebServicePortal.asmx"/>-->

<!--<add key="CslaDataPortalProxy" value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostvb"/>-->

</appSettings>

Also, I noticed that, after I used SQL Server 2005, there is no difference if I comment or uncomment the "CslaDataPortalProxy" in appSettings as shown above. In all cases, it works.

You help will be greatly appreciated.

Tarek.

cliffordru replied on Saturday, April 05, 2008

Tarek,

Glad to hear you were able to resolve the issue.  The proxy settings are used to configure the business objects to work in an N-Tier environment.  Essentially they dictate how remote objects will be passed between tiers.  Unless you are using a separate web and application server you can leave these commented out and use the default setting which is to run the data portal locally.

To learn more, your best resource would be to purchase Rocky's business object book as well as his eBooks.  There is a wealth of information in these books covering both Csla as well as .Net best practices and concepts.

tarekahf replied on Thursday, April 10, 2008

Just to confirm, I had to comment out all Proxy things in appSeetings section to allow the applicaiton to run successfully.

I deployed the PT Sample Web Application and Windows Applicaiton to 3 of my colleagues. They all worked eventully (PTWeb and PTWin).

However, I am facing the following difficulties/problems, but not sure exactly why and some timed, not sure how I solved the problem.

The problems I am facing while trying to deply and run the PT Applicaiton:

1. When try to deploy locally (Windows XP + SQL Express), and try to connect to SQL Express Database using the Database Name in the Connection String in web.config and app.config, I get errors like "Duplicate Connection Name", "Cannot login to Database", or "Cannot get an instance of the SQL Server" ... or something like that. Then I noticed that there are 2 Data Connection entries created in the "Server Explorer" Window of VS2005 (PTrcker and PTSecurity) automatically, everytime I close/re-open the Solution File, and they are poiniting to a directory that does not exist on my PC and there is no reference to such directory under the whole Solution. Why ? From where they are coming ? Sometime it seems the probelm is solved if I delete such entries. But they always come back !!! Why ?

2. I copied the Databases to SQL Server 2005 say on  Server Machine 1, deployed the Solution on this machine, and both PTWeb and PTWin worked successfully when executed from my PC, of course, after I updated the connection string.

Then later, I tried to make another deployment to another new Machine (Server Machine 2), almost same environment, with the following differences: .NET Framework 2.0 + SP1, SQL Server 2005 Express, and latest SP for Windows Server 2003 (to the best of my knowledge). But, on Machine 2, both PTWeb and PTWin do not work !! I figured out that PTWeb does not work becasue of SharePoint Server serious installation problems (IIS do not work becuase of this probelm). But for PTWin, when I try to execute this project from my PC, I get error that the the User ID xyz (my ID) cannot login SQL Server or Login Failure message or somthing like that. Even when I put any dummy name on the Connection String for the Database, I get the same error. When I create the same connection from "Server Explorer" Window to SQL Server 2005 Express on Machine 2 from my PC, the connection works successfully.

3. I was unable to use .\SQLEXPRESS connection string to connect to SQL Server Express on Machine 1, although I am sure it is there. Only worked with SQL Server 2005 normal connection string.

When I try to create a connection from "Server Explorer" window in VS2005 from my PC to a SQL Database Name (SQL Express) on Machine 1 or 2, and I specifiy the path as a shared foler on that machine, I get error that can not get instance of SQL Server of something like that, and I am sure that SQL Express is there and running. Why ?

Any feedback will be appreciated.

Tarek.

tarekahf replied on Saturday, April 12, 2008

Dear All,

First of all, the problem of WSS was resolved !! When I installed WSS, it replaced the default website ...  ! After I removed WSS, the default web site worked normally.

Then I tried to browse the PTWeb project, and I got error "cannot login to Database PTSecurity with the ASP.NET User..." or something like that.

Then, I changed the case of the Database Name in SQL Server 2005 to match it with the case used in web.config.... ! and guess what, it worked !!!

So, the Database names used in web.confing are Case Sensitive ??!! This is realy new to me !

Now, PTWeb is working fine on the new server. My next step is to try use Windows Authentication in this project. I have created a separate thread for this, and there are few things to try already.

But, still getting intermittent error when connecting the project using Database Name to SQL Server Express on the local machine. I hope some one can give me some help on this.

I like to have local installation so that I can take to project with me home on a Laptop to play with it.

Questions:

What is needed to connect the project to SQL Server Express locally ?

Why these connection entries (PTracker.mdf and Security.mdf) are showing under "Server Exploere" window under Data Connections, with the following connection string:

Data Source=.\SQLEXPRESS;AttachDbFilename="D:\Visual Studio Projects\csla20\ProjectTracker20vb\PTracker.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True

Data Source=.\SQLEXPRESS;AttachDbFilename="D:\Visual Studio Projects\csla20\ProjectTracker20vb\Security.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True

From where they are coming, and are they useful ? When I click on the PTracker.mdf to expand it, I get error: "Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."

Regards ...

Tarek.

Copyright (c) Marimer LLC