Solved

unable to load assembly

Posted on 2006-07-03
47
865 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
Comment Utility
Does the server support ASP.NET 2.0?
0
 

Author Comment

by:Andrewajp002
Comment Utility
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
Comment Utility
Go to:

   C:\Windows\Microsoft.Net\Framework

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

Expert Comment

by:willbdman
Comment Utility
.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
Comment Utility
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
Comment Utility
Nope, the standard version will suffice. Just make sure its not the Compact framework.
0
 
LVL 6

Expert Comment

by:willbdman
Comment Utility
0
 
LVL 6

Expert Comment

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

Author Comment

by:Andrewajp002
Comment Utility
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
Comment Utility
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
Comment Utility
Shouldn't have to as it is part of the .NET framework and should be referenced automatically.
0
 

Author Comment

by:Andrewajp002
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Andrewajp002
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Maybe this will offer a few ideas:

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

Author Comment

by:Andrewajp002
Comment Utility
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
Comment Utility
Do you have other apps on the same server connecting to the same DB ?
0
 

Author Comment

by:Andrewajp002
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

11 Experts available now in Live!

Get 1:1 Help Now