views:

37

answers:

2

I have created on my local machine with targetframework 4 in visual studio a simple website using the default template (the one with css problem solved here http://stackoverflow.com/questions/3897781/google-maps-api-in-asp-net-masterpage-why-it-stays-blank)

I uploaded it to my IIS 7 server which was first configured for .NET 2 so in web.config I deleted the line

<compilation debug="false" targetFramework="4.0" />

so that it can run on .NET 2.

Until then that was fine.

Then I edited in ISS7 my website to use .NET 4. When testing the site again, I got this error:

Failed to generate a user instance of SQL Server due to 
failure in retrieving the user's local application data path.

I hadn't told you that I didn't install any sql server yet so this message may be normal but why didn't I get it with .NET 2 ? Could I configure something in .NET 4 so that this error is ignored like on .NET 2 ?

+1  A: 

When a user logs in for the first time a profile is created on disk for example in c:\users\username.

If you are in the security context of a user that has never logged in to that machine in a way that creates the profile, and you try to write information to the profile, you get a sort of "directory does not exist error".

There must be a difference in the security context between .net 2 and 4.

Shiraz Bhaiji
+1  A: 

It is rather difficult to understand what you are doing and why

"I hadn't told you that I didn't install any sql server yet"

Visual Studio (VS) installs SQL Server Express (configured, by default, for local use only, remote one should be enabled) but IIS7, ASP.NET or Windows doesn't

"I have created on my local machine with targetframework 4 in visual studio a simple website using the default template"

If you created a project targeting ASP.NET4.0, you cannot run it with ASP.NET 2.0 (you can do it vice versa, to run in 4.0 created for 2.0)

Which default template? They are configured in VS after or during VS setup

"Failed to generate a user instance of SQL Server"

User instance of SQL Server is created during ASP.NET project creation in VS2010 targeting 4.0 which you do not have on uploaded machine (you may check that folders and files for ASP.NET membership are created using SQL Server USer Instance). They are not created by project targeting 2.0

What is the sense of creating ASP.NET 4.0 project and then test it in ASP.NET2.0 machine? Create it targeting 2.0 from the scratch.

-- Update:
This is common software principle called backward compatibility - the software knows and can accommodate for previous (in 2.0 for 3.0, 1.0, 1.1) but not for future differences (in 2.0 for 4.0)
http://en.wikipedia.org/wiki/Backward_compatibility

You can create project targeting 2.0 and change for 4.0 later on or do not use Visual Studio at all if you are uncomfortable with it.

vgv8
There's no sense except it just happened to be configured like that in the first place, that I didn't know how to change that and once I knew I was surprised that .NET 4 behaves much more drastically than .NET 2 so I am curious to know why.
Locally I don't have SQL server either because It didn't want to install on my windows 7
Because asp.net websites/webapplications almost always need user/role membership features, If you do not need it, target ASP.NET 2.0 when you create website (or webapplication project) in VS2010. That's simple
vgv8
It is *NOT* ".NET4.0 behaves", it is specifically Visual Studio 2010 when targeted .NET4.0, i.e how you engage it (without knowing what they do and how to use them).
vgv8