LankyNibbs

Hi all-

I'm running VS 2005 final release version.  I have a solution with two projects in it; an ASP.NET website in C# and a VB project which is my data access layer.

Yesterday, this code was working fine.  I can compile and run the solution, and all the code works.

But when I try to access or add a new datasource through the VS 2005 Data Sources Explorer, I get a popup which says: "An unexpected error has occurred.  Error message: key not valid for use in specified state."

This message pops up after I select database as the source of my new datasource.  The wizard does NOT fail if I use a Web Service as my new datasource.

Any ideas on what is happening, and how to clear up the problem


Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

LankyNibbs

More information:

I uninstalled WSE 3.0 final and reinstalled, rebooted, and started up VS 2005.  Opened my solution, tried to add a new data source, and the wizard didn't immediately throw the error!  cancelled the Add Data Source operation, and tried it again.  This time, I got this popup:

"An error occurred while creating the new data source:  value does not fall within the expected range."




Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

LankyNibbs

Hmmm, possible solution:

I went into my Server Explorer and created a new Data Connection to replace the old one.  I checked the option to leave sensitive info exposed in the .config file, and was able to then create my new data sources.

I think what happened here is that somehow VS 2005 lost an encryption key, and couldn't read the encrypted sensitive info in the config file for the autogenerated data connection.




Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

mjl

I met the same issue and resolved by the same way - removed and created a new data connection. Thank you LankyNibbs.... :D






Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

Moumen

Hi,

This method did not work with VB.NET Applications.

After 6Hours of searching for solution on the internet, I back with no answer, but at least i know what cause the problem, it was Changing Administrator password .

"The most common issue in this area occurs when a local (non-domain) user's
password is administratively reset. On WinXP, this causes all data protected
by DPAPI (including user private keys) to be lost; at least until the
password is set back. This is by design, and in fact is an important
security feature.
"

So my next step was searching where VS2005 Save the Data Connection information, after few minutes of searching in my pc I found it, it was in:

C:\Documents and Settings\Administrator\Application Data\Microsoft\VisualStudio\8.0\ServerExplorer\DefaultView.SEView

Then I tried to modify the keys in this file, but with no results.

My last hope was deleting the file, and finally it works , and all projects runs again normally.






Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

nrb1955

I had the same problem after re-installing Active Directory on my Primary Domain controller and copying my roaming profile to my 'new' user profile.

I deleted the entire 'C:\Documents and Settings\%username%\Application Data\Microsoft\VisualStudio' folder and all was well.





Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

Al1234511234

ditto did the same thing

renamed

C:\Documents and Settings\al\application data\Microsoft\VisualStudio\8.0\ServerExplorer\DefaultView.SEView

and everything was fine






Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

u_r_twisted

I got the same problem and your post just spared me the misery of rummaging for solution . Thank you very much



Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

Larry Niemoeller

I am working on a VB.NET Windows application. Every six months are password has to be changed. The provided method to do so failed, so the contractor (administrator) reset my password. I had the same problem. I deleted and created the connection files (2) and it appeared to resolve the above problem. However, when I went to publish my project, I received the error;

"Sign Tool - keyset does not exist"

Any ideas The system won't let me change my password back to the old one, as it is in the password history file.

Thanks, Larry Niemoeller (240) 453-8296





Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

antointhe

Larry

 I was going to say the following...

Since I don't have a similar setup, I suppose I can only go lateral with this idea.  I would assume that there is a similar file for signing your code.

I assume you got your datasources working since you didnt mention those.





Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

Flounder

This solution also worked for me. We changed our domain name and got new userid's. Next thing I know, could not open any of our datasets in our projects. Renamed the file and everything is ok now.



Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

Integralsoft

Thanks a LOT! You solved my problem and saved me a lot of aggravation.



Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

gruskada

Deleting the whole folder (C:\Documents and Settings\%username%\Application Data\Microsoft\VisualStudio\8.0) worked for me as well. Thanks for posting this.




Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

ibhoopn

renamed file, thanks for the solution!



Re: Visual C# IDE VS 2005: "Key not valid for use in specified state"

Zantac

Strange I'd changed my Network Password and this fault happened.

A new instal did not cure the problem.

c:\documents and settings........etc................didnt contain the folder application data---- so! I deleted the my documents\ Visual Studio 2005\ Backup Files folder

Also deleted the datasource datatables that remained persistent.

The latter may have been sufficient to cure

Then Back on Line.