Solved

unable to load assembly

Posted on 2006-07-03
47
866 Views
Last Modified: 2007-12-19
Hi,

I have built an app that works fine in 2002, just upgraded to 2005 and had a whole load of null value excepts.  I think I ahve finally solved them, but I has since uploaded this new app to the server to replace the old one and when I go into admin tasks to add the new assembly to the the code groups and strong name it will not import the information.

Any Ideas?

Andrew
0
Comment
Question by:Andrewajp002
  • 23
  • 15
  • 9
47 Comments
 
LVL 6

Expert Comment

by:willbdman
ID: 17030346
Does the server support ASP.NET 2.0?
0
 

Author Comment

by:Andrewajp002
ID: 17030364
it is running sql server 2000, i can check, where would i find on the server this information, in admin tools?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17030392
Go to:

   C:\Windows\Microsoft.Net\Framework

and look for a folder named:  v2.0.50727
0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030420
.NET has nothing to do with the SQL Server installation.

Not sure where you would find the info on the webserver.

Do you own the webserver or are you renting it off of another hosting company?

For your reference:-

.NET 2002 uses .NET 1.0 framework

.NET 2003 uses .NET 1.1 framework

.NET 2005 uses .NET 2.0 framework

hence the problems you encountered when you upgraded.

If the webserver you are trying to run your asp.net application from hasn't been upgraded to .NET 2.0 framework then your upgraded application won't work.

0
 

Author Comment

by:Andrewajp002
ID: 17030445
We own it, and I have full control of this server.

The old app is fine until I started using vb.net 2005.

Ok, looked on the server and it only has v1.0.3705, so I need to install v2 onto the server.

Is there a special version required for server 2000?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17030471
Nope, the standard version will suffice. Just make sure its not the Compact framework.
0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030517
0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030523
Alternatively, if you have your 2005 install discs, it will be on the required disc.
0
 

Author Comment

by:Andrewajp002
ID: 17030740
Ok thanks, I have updated the framework on the server, but stills seems to have a problem with the security settings.

When I run the app on my local machine its fine, I cant figure out which setting now have changed.

I have set the strong name and given the assembly full trust.
0
 

Author Comment

by:Andrewajp002
ID: 17030794
I ahve noticed that under references that system.data.sqlclient is not listed, but when I add it it says all other instances are ambigous as I have imported sqlclient within the firms themselves.

Does sqlclient still need to be listed inside the references?
0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030837
Shouldn't have to as it is part of the .NET framework and should be referenced automatically.
0
 

Author Comment

by:Andrewajp002
ID: 17030855
Thats what I thought.  It must just be a security issue, the version under 2002 works ok on the server and local, 2002 works locally but not on the server.

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

This si the same error ive had for ages, it used to always appear locally as well, but I have changed the code and it now works ok locally.

Do I have to set any of the net framework v2 security settings on the server?
0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030888
possibly yes - should have to setup same as you had 1.0 setup.

There will also be two server setups one for 1.0 and one for 2.0 - you need to ensure the server is actually using the 2.0.

I did it on my system by doing the following:-

Control Panel -> administrative tools -> internet information services

expand what is shown on the left by clicking the + sign.

on the websites folder right-click and go to properties.

Select the ASP.NET tab at the top. It should then tell you the .NET version being used; you can change it by using the drop-down box and clicking apply
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17030890
It could be down to the sercurity policy on the server for the account under which your app is running.
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17030918
Just to clarify: Is this actually a WebApp ? Only you never mentioned in your post if it was or not. I think we're just assuming because your uploading it to a server that it is.
0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030919
check the account security by going to Control Panel -> Administrative Tools -> .NET Framework 2.0 configuration

click on   Configure Code Access Security Policy

then  Adjust Zone Security
0
 

Author Comment

by:Andrewajp002
ID: 17030935
firstly, its a server app, a specificly designed app for work, hosted on my server which others have a link to to use it / log in.

You are correct that the server, even though i had installed v2 it was still set to v1, problem is I have a web app running off the server as well and when I changed the version the web app stopped working.

I will test the non web app to see if this corrects the problems, if so I might have to re configure my web app as well (
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17030952
If its not a webapp then don't change the settings in IIS, these settings only relate to your webapps. If your web app runs on v1 then leave the settings under IIS' ASP.NET tab on v1.

0
 
LVL 6

Expert Comment

by:willbdman
ID: 17030976
Yes i agree with Carl.

are you having a problem when connecting to the server app?

or on the server itself?
0
 

Author Comment

by:Andrewajp002
ID: 17031009
just the app, as the procedure for v1, i compile the app in vb.net and then copy the exe file to the servers location.

Once there I go to the local machine and set the frameworks security settings and code groups strong name.

it will run the app but will not allow it to connect to the DB and thats when it crashes..
0
 

Author Comment

by:Andrewajp002
ID: 17031016
In admin tools on the server, it only has one set of .net config tools for v1, it doesnt have a wizard or config for v2
0
 
LVL 6

Assisted Solution

by:willbdman
willbdman earned 250 total points
ID: 17031135
hmmm

try this:-

START -> RUN

type:  mmc

click OK

go to File -> Add/Remove Snap ins

click on Add...

Is .NET framework 2.0 in the list - if so add it
0
 

Author Comment

by:Andrewajp002
ID: 17031226
strange, it isnt there, only the v1 config manager, could i have installed the correct version, the server is running winnt with server 2000 I think
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Andrewajp002
ID: 17036004
morning all

Another day another headache :)

OK, trying to sum up whats happened so far

The server (winnt + sql server 2000) has now v2 installed but isnt showing it in cmm.

The app is not a web app, its stored on the server and uses access it by having a link to the exe saved on their desktops.

All users have v2 installed, and the app works fine locally, but the server doesnt allow the app to connect to the DB once on the server.

I have set the trust level on both te server and locally in Intranet Zone to full trust and have trusted the assemby and trusted the code group in the trusted zone of the v2 config.

Think thats it, if anyone knows of anything I might have missed to get the server to connect to the DB and stop this headache, I will be most grateful

Thanks

Andrew
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036012
You say the server won't allow the connection to the DB, what does it do ? Does the app throw an exception, or does the OS complain ?
0
 

Author Comment

by:Andrewajp002
ID: 17036019
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Def. a security issue, but cant work out whats causing it.
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036030
Maybe this will offer a few ideas:

    http://blogs.msdn.com/shawnfa/archive/2003/06/20/57023.aspx
0
 

Author Comment

by:Andrewajp002
ID: 17036058
Its saying that "System.Data.SqlClient.SqlClientPermission"  was the first to fail, ive done everything in the blog :(

Must be something Im missing
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036065
Do you have other apps on the same server connecting to the same DB ?
0
 

Author Comment

by:Andrewajp002
ID: 17036077
I have an earlier version of the same app running on the server thats works fine.

Strange thing is that v1 config manager will not allow me to add the assembly as a strong name, is this because 2005 uses v2 framework only?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036081
Possibly. Although unless you are installing your assembly in the GAC then it doesn't really need to be strongly named.
0
 

Author Comment

by:Andrewajp002
ID: 17036095
It doesnt seem to be a problem with the app, that loads fine on the server its just when it hits the security permissions on login that it crashes.

I installed V2 on the server yesterday but it doesnt apprear in the cmm, are there any obivous settings on the server that need to be set to allow the security permissions to work?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036143
Its a bit of a vague message so its difficult to tell.

Does your app use a SQL Login or Windows Login for the DB ? Is it possible to modify the app the catch the exception and find the inner exceptions to try and get a little more detail ?
0
 

Author Comment

by:Andrewajp002
ID: 17036151
it uses an sql login, i will see if i can add a catch to the login and see if it helps
0
 

Author Comment

by:Andrewajp002
ID: 17036178
The key thing as I can see is that .net framework is not allowing me to trust the new assembly.

I cannot add the new assembly to the v1 or v2 config, and I think that is whats causing the security error.
0
 

Author Comment

by:Andrewajp002
ID: 17036221
When I actually Publish the app rather than using the exe from the bin the app will install but will not start, it logs the following

PLATFORM VERSION INFO
      Windows                   : 5.1.2600.131072 (Win32NT)
      Common Language Runtime       : 2.0.50727.42
      System.Deployment.dll             : 2.0.50727.42 (RTM.050727-4200)
      mscorwks.dll                   : 2.0.50727.42 (RTM.050727-4200)
      dfdll.dll                   : 2.0.50727.42 (RTM.050727-4200)
      dfshim.dll                   : 2.0.50727.42 (RTM.050727-4200)

SOURCES
      Deployment url                  : file://sqlserver/forms/Surveyors/Cost%20Recon%20Form/Surveyors%20cost%20recon%20form%202.application
      Deployment Provider url            : file://sqlserver/forms/Surveyors/Cost%20Recon%20Form/Surveyors%20cost%20recon%20form%202.application
      Application url                  : file://sqlserver/forms/Surveyors/Cost%20Recon%20Form/Surveyors%20cost%20recon%20form%202_1_0_0_3/Surveyors%20cost%20recon%20form%202.exe.manifest

IDENTITIES
      Deployment Identity            : Surveyors cost recon form 2.application, Version=1.0.0.3, Culture=neutral, PublicKeyToken=33c1dd3ab1c43add, processorArchitecture=msil
      Application Identity            : Surveyors cost recon form 2.exe, Version=1.0.0.3, Culture=neutral, PublicKeyToken=33c1dd3ab1c43add, processorArchitecture=msil, type=win32

APPLICATION SUMMARY
      * Installable application.

ERROR SUMMARY
      Below is a summary of the errors, details of these errors are listed later in the log.
      * Activation of \\sqlserver\forms\Surveyors\Cost Recon Form\Surveyors cost recon form 2.application resulted in exception. Following failure messages were detected:
            + Activation failed due to a Windows Side-by-Side error. System Event Log may contain some more information about this failure.
            + This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)

COMPONENT STORE TRANSACTION FAILURE SUMMARY
      No transaction error was detected.

WARNINGS
      There were no warnings during this operation.

OPERATION PROGRESS STATUS
      * [04/07/2006 12:00:43] : Activation of \\sqlserver\forms\Surveyors\Cost Recon Form\Surveyors cost recon form 2.application has started.
      * [04/07/2006 12:00:44] : Processing of deployment manifest has successfully completed.
      * [04/07/2006 12:00:44] : Installation of the application has started.
      * [04/07/2006 12:00:44] : Processing of application manifest has successfully completed.
      * [04/07/2006 12:00:45] : Request of trust and detection of platform is complete.
      * [04/07/2006 12:00:47] : Downloading of subscription dependencies is complete.
      * [04/07/2006 12:00:47] : Commit of the downloaded application has started.
      * [04/07/2006 12:00:47] : Installation of application has successfully completed.

ERROR DETAILS
      Following errors were detected during this operation.
      * [04/07/2006 12:00:47] System.Deployment.Application.DeploymentException (Activation)
            - Activation failed due to a Windows Side-by-Side error. System Event Log may contain some more information about this failure.
            - Source: System.Deployment
            - Stack trace:
                  at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, Uri activationUri)
                  at System.Deployment.Application.SubscriptionStore.ActivateApplication(DefinitionAppId appId, Uri activationUri)
                  at System.Deployment.Application.ApplicationActivator.Activate(DefinitionAppId appId, AssemblyManifest appManifest, Uri activationUri)
                  at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut)
                  at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
            --- Inner Exception ---
            System.Runtime.InteropServices.COMException
            - This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1)
            - Source: System.Deployment
            - Stack trace:
                  at System.Deployment.Application.NativeMethods.CorLaunchApplication(UInt32 hostType, String applicationFullName, Int32 manifestPathsCount, String[] manifestPaths, Int32 activationDataCount, String[] activationData, PROCESS_INFORMATION processInformation)
                  at System.Deployment.Application.ComponentStore.ActivateApplication(DefinitionAppId appId, Uri activationUri)

COMPONENT STORE TRANSACTION DETAILS
      * Transaction at [04/07/2006 12:00:47]
            + System.Deployment.Internal.Isolation.StoreOperationStageComponent
                  - Status: Installed
                  - HRESULT: 0x0
                  - Manifest: 4D5DXKJM.18X.application
            + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
                  - Status: Set
                  - HRESULT: 0x0
            + System.Deployment.Internal.Isolation.StoreOperationStageComponent
                  - Status: Installed
                  - HRESULT: 0x0
                  - Manifest: Surveyors cost recon form 2.exe.manifest
            + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile
                  - Status: Installed
                  - HRESULT: 0x0
                  - File: CTRUK.ICO
            + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile
                  - Status: Installed
                  - HRESULT: 0x0
                  - File: My Project\Application.myapp
            + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile
                  - Status: Installed
                  - HRESULT: 0x0
                  - File: Surveyors cost recon form 2.exe.config
            + System.Deployment.Internal.Isolation.StoreOperationStageComponent
                  - Status: Installed
                  - HRESULT: 0x0
                  - Manifest: Surveyors cost recon form 2.exe.genman
            + System.Deployment.Internal.Isolation.StoreOperationStageComponentFile
                  - Status: Installed
                  - HRESULT: 0x0
                  - File: Surveyors cost recon form 2.exe
            + System.Deployment.Internal.Isolation.StoreOperationInstallDeployment
                  - Status: Installed
                  - HRESULT: 0x0
                  - AppId: file://sqlserver/forms/Surveyors/Cost%20Recon%20Form/Surveyors%20cost%20recon%20form%202.application#Surveyors cost recon form 2.application, Version=1.0.0.3, Culture=neutral, PublicKeyToken=33c1dd3ab1c43add, processorArchitecture=msil
            + System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
                  - Status: Set
                  - HRESULT: 0x0
            + System.Deployment.Internal.Isolation.StoreTransactionOperationType (27)
                  - HRESULT: 0x0
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036245
So, you are attempting a side-by-side installation ? In that case you will need to strong name your assembly prior to deployment so that it can be differentiated from the existing version. Either that or you will need to remove the exisitng version first.
0
 

Author Comment

by:Andrewajp002
ID: 17036290
ok, but the problem I have is that I cant add this new assembly into the net framework, seems like im going round in circles :(  I will get it.

Do you think it would help assigning a certificate to it?  does it really matter?

The other thing is that V2 doesnt appear in either cmm or in admin tools?   could this be a factor?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036326
Open up MMC and see if you can add the v2 config manager to it.

Go to Start > Run and type "MMC"

Then in the console go to:  File > Add/Remove Snap In..., then click the Add button and see if ".Net Framework 2.0 Configuration" is on the list.
0
 

Author Comment

by:Andrewajp002
ID: 17036346
It wasnt there before, im uninstalling v2 on the server and re installing it, see if that works
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 250 total points
ID: 17036370
On my system teh .Net2 config actually live in the SDK folder rather than the Framework folder, so downloading the SDK may be an idea:

http://www.microsoft.com/downloads/details.aspx?familyid=FE6F2099-B7B4-4F47-A244-C96D69C35DEC&displaylang=en
0
 

Author Comment

by:Andrewajp002
ID: 17036406
one thing ive noticed is that at the beginning when I first created ths app I added the assembly to the Enterprise code groups, all code section as a strong name.  When I try to add this assembly it fails to load, saying the assembly is invalid?

0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036498
Do you have an older version of the same asseblmy already installed ? Your installation log suggests a problem with side-by-side installation so there may be a conflict.
0
 

Author Comment

by:Andrewajp002
ID: 17036531
well, technically its the same app, but a newer version, oh, it will be using the same sn k, could that be affecting it?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17036570
If it is a newer version of an existing assembly and it has been strongly named then it should be ok. The strong name contains the version number of the assembly to allow side-by-side installation. Although i'm not sure what issues might arise from two versions of the same assembly compiled under different versions of the framework.
0
 

Author Comment

by:Andrewajp002
ID: 17037157
ok, ive installed the whole sdk 2 package on and guess what, its working alittle, it does open on the server now, but still cannot connect to it remotely, but things are looking up.
0
 

Author Comment

by:Andrewajp002
ID: 17037356
ok, i added the assembly into the enterprice are of the code groups and I think it worked ok, works on my machine from the server which is good, just need to test it out on another laptop to make sure.

Thanks Carl & Will, I will split the points as you have both been great.  

Thanks

Andrew
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now