The web application .... has not loaded the .Net framework.

Hi

I have been having a persistant problem since installing Visual Studio 2005 on my machine.

I can no longer profile web applications.

I get the following error when i try to take a snapshot.

The web application .... has not loaded the .Net framework. Please check that the ........aspx is an ASP.NET web application. Please note that accessing cached web pages will not load the .Net Framework.

I have read a couple of posts on the forum and i have upgraded the software to version 2.7.1.20.

I have selected the correct .Net framework version when starting the profiler and i still cannot get this to work.

Can you please advise on what steps i might take to remedy this issue.

Kind regards

nick graham

Comments

  • Hi,

    Can you confirm whether you're running IIS5 or IIS6, and if IIS6, whether you're running in IIS5 Isolation Mode? (You can tell this by whether ANTS warns you that it's about to restart IIS when you start profiling)

    Secondly, have you tried profiling your application in the ASP.NET development web server? Have a look at: http://www.red-gate.com/messageboard/vi ... php?t=3472 if you haven't already.

    Thanks,
    Rob
    Robert Chipperfield
    Red Gate
  • Hi Rob

    Thanks for your reply.

    In answer to your question - I'm running IIS5 and when the profiler starts it stops a number of services and then starts them again. It does not perform an iisreset operation, well at least this is not communicated in the on screen messages.

    Also i have read the article you suggested i looked at - however i am currently only interested in profiling .Net 1.1 framework web applications so profiling on the dev server will not be of use to me.

    I have checked to make sure all code is in DEBUG mode. That DEBUG is set to true in the web config file.

    I'm starting to loose time as a result of this issue - and any help would be much apreciated.

    Kind regards

    Nick Graham
  • Hi Nick,

    I'm afraid I don't know of a straightforward reason why you're having these problems, but if you're happy to do a little debugging, then maybe we can help...

    If you can download Process Explorer: http://www.microsoft.com/technet/sysint ... lorer.mspx

    Then, start profiling your ASP.NET application, and run Process Explorer. In the list of processes, you should find "inetinfo.exe", and then further "aspnet_wp.exe".

    If you choose "Show Lower Pane" from the view menu, then set "Lower Pane View" to "DLLs", you should get a list of the DLLs loaded for the currently selected process.

    If you select the aspnet_wp.exe (the ASP.NET worker process), could you confirm whether mscoree.dll appears (and that its version is the same as you expect), and further whether RedGate.Profiler.Core2.dll does?

    Another test is to check the security settings and environment variables for the ASP.NET process. If you right click on it and choose properties, the Security tab should show "User" as being "<your-machine-name>\ASPNET". Similarly, on the Environment tab, could you check whether "COR_PROFILER" is set on the list of variables?

    Sorry that this is a rather involved process, but with a bit of luck it will let us work out where the problem lies.

    Many thanks,
    Rob
    Robert Chipperfield
    Red Gate
  • OK I've installed it and looked at the processes - i cant find the aspnet_wp.exe process while running the profiler.

    This is strange - because i attach to this process to step through our business objects.

    Its been a while since i have needed to do this, but i have never known this process not to be running before - do you know what might cause this and do you know if this may be the issue?

    Cheers

    nick
  • I have been having the same issue...

    I downloaded the process explorer and here is what I found:

    1. The aspnet_wp.exe is running
    2. I can confirm that the mscoree.dll appears
    3. mscoree.dll is version 2.0 (What I expect it to be)
    4. I CANNOT find RedGate.Profiler.Core2.dll
    5. Since I am running the .net process as a domain account I see TERRA\JICSvcAdmin not MachineName\ASPNET
    6. COR_PROFILER does NOT exist in the list of variables.
  • Nick: strange indeed! Do you see inetinfo.exe? Which isolation / protection level are you running at?

    Joe: Aha, I think there lies the explanation! Currently ANTS assumes that the ASP.NET worker process is running as the ASPNET account, and sets the necessary environment variables as such.

    I suspect that if you were able to run it as the ASPNET user, it should work - is this something you're able to do?
    Robert Chipperfield
    Red Gate
  • Sorry... slight correction there (having checked the relevant bit of code): we do attempt to get the correct credentials if it is not running under the ASPNET user, but this could well be failing (it sounds like it is in this case).

    I think it's still worth giving it a go under the ASPNET user if you are able to.

    Rob
    Robert Chipperfield
    Red Gate
  • Bingo that's my problem... As soon as I changed the .net worker process to run under ASPNET user credentials the snapshot worked and the process explorer shows the RedGate.Profiler.Core2.dll under the aspnet_wp.exe.

    Your attempt at getting the correct credentials does not seem to be working in this case. I assume a bug fix is in order? :)

    Thanks,
    Joe
  • Yes I get the inetinfo.exe process.

    As for isolation level - how can find this out?

    Cheers

    nick
  • Hi Nick,

    If you go to the IIS manager in Control Panel, then navigate to the website you're trying to profile, right click and go to properties, then go to the home directory tab, you should see an "Application Protection" drop-down box at the bottom.

    I've got mine set to "Medium (Pooled)", which I believe is the default, though quickly changing it to low, I still got the ASP.NET worker process to show up.

    Maybe you can confirm that you're still able to debug ASP.NET applications by attaching to the ASP.NET process?

    Rob
    Robert Chipperfield
    Red Gate
  • In the event viewer - i also have the following error.

    System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable host

    Server stack trace:
    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
    at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
    at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
    at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
    at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
    at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
    at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

    Exception rethrown at [0]:
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
    at RedGate.Profiler.Engine.ProfilingSession.ServiceStatusCallback(Object sender, StatusEventArgs e)
    at RedGate.Profiler.Engine.ProfileIISController.OnStatus(StatusEventArgs e)
    at RedGate.Profiler.Engine.ProfileIISController._4()

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
  • Hi - the protection level is set to medium Pooled.

    I'm checking all these things on my machine and on another developers machine, he also has profiler installed but his works. and his settings are all currently coming up as the same as mine. V Frustrating.

    nick
  • Hi Nick,

    If you haven't already, could you create a directory called "logs" in the ANTS Profiler installation directory? Having done that, restart the ANTS Profiler Service and ANTS Profiler itself and try profiling your website again. That should cause two or three log files to be created in the logs directory. I'll PM you my email address - if you could send them over, I'll take a look at them.

    Thanks,
    Rob
    Robert Chipperfield
    Red Gate
  • Hi Joe,

    If you're still watching this thread, could you quickly try this for me?

    In your machine.config file (in the .NET framework directory -> config directory), could you see whether the "processModel" element (which should have details of your username and password for the ASP.NET worker process) has an "enable" attribute set on it?

    If not, could you try adding enable="true", and try profiling again? That means it will look something like:
    &lt;processModel userName="DOMAIN\User.Name" password="[email protected]" enable="true" /&gt;
    

    I'd be interested to know if that helps...

    Rob
    Robert Chipperfield
    Red Gate
  • Sorry Rob that did not help. I changed the process model to look like this...

    <processModel userName="TERRA\JICSvcAdmin" password="password" enable="true" />

    For a windows xp PC I believe enable is true by default.
  • Hi,

    Bother, that would've been an easy solution :-). You're right in saying that enable="true" is default (in .NET 2.0's machine.config at least), but the ANTS code didn't make that assumption, I think.

    Am I right in thinking (with the machine.config like that) that you still aren't getting any error messages until you come to finish profiling, at which point it tells you that the .NET framework was not loaded?

    Another thing that could be worth trying is running it as a local system user that isn't ASPNET - this would maybe isolate whether it's the fact it's a domain user causing a problem, or just the fact that it isn't ASPNET.

    The setup I tested this on most recently was a clean install of WinXP SP2, IIS, ASP.NET 2.0 / .NET 2.0, and the domain user added to a member of the local Administrators group. I also added the domain user to the "log on as a batch job" set in the local security policy.

    Rob
    Robert Chipperfield
    Red Gate
  • There are two times that I get the .Net framework was not loaded error. The profiler restarts all the IIS services correctly and launches the browser. When I click on Take Snapshot I get the first error. The second time is when I close the browser and the focus returns back to ants profiler.

    Okay I tried running it under a local system account here is where I am with the test:

    1. I created a TestUser account on my local PC.
    2. Rebooted and logged in as the TestUser.
    3. Tried to run ANTS and got this error "The user ASP.NET process is configured to run under must be different to the current logged on user".
    4. I logged of and logged back in as myself TERRA\jschmaltz
    5. I started up ANTS profiler and when it was attempting to restart the services I got this error "Couldn't log on as the ASPNET user [1385].
    6. I check the current running process aspnet_wp.exe and the user it is running under is the TestUser.
    7. I then checked my machine.config to make sure I had everything set up correctly for the the TestUser account. <processModel userName="TestUser" password="password" enable="true" />
    8. The last test I ran was to just bring up the web site in the browser. http://localhost/johnson/trademanager/default.aspx. This worked with the exception of data access because TestUser is a local account.

    I'm not sure why it is attempting to use the ASPNET account?
  • Hi,

    Thanks for running through that. The message in step 5 needs a bit of elaboration - firstly, there's a slight typo in the code, and it really means "as the ASP.NET process user" rather than ASPNET explicitly. Secondly, error code 1385 means TestUser doesn't have permissions to log on as a batch job.

    You can grant batch privileges as follows:
    - Control panel
    - Administrative tools
    - Local security policy
    - Local policies
    - User rights assignment
    - Log on as a batch job
    - Add TestUser to that set
    - (You may also want to add your domain user that you ultimately want to profile as here as well)

    Finally, when you were running ASP.NET as the domain user, was this the same user as you logged on as, or a different one?

    Thanks,
    Rob
    Robert Chipperfield
    Red Gate
  • Okay a bit of progress...

    I granted batch privileges to the TestUser local account and ran profiler with success! I was able to take the snaptshot. I checked to make sure that the domain account I was using also has log on as batch job enabled and it does. The accounts I have are:

    ASPNET
    IUSR_JSCHMALTZ
    JSCHMALTZ\TestUser
    SQLDebugger
    TERRA\JICSvcAdmin
    VUSR_JSCHMALTZ

    I've tried running the profiler and the aspnet process under several accounts now let me break them down for clarity:

    ASPNET Logged On User Success/Fail

    ASPNET TERRA\JSCHMALTZ Success
    TERRA\JICSvcAdmin TERRA\JSCHMALTZ Fail
    TERRA\JICSvcAdmin TERRA\JICSvcAdmin Fail
    TestUser TestUser Fail
    Testuser TERRA\JSCHMALTZ Success
  • That's good news at least - it suggests that we're picking up the username and password correctly.

    The configurations where the ASP.NET user is the same as the logged on user are expected to fail - we don't want to modify the profile that's currently active.

    This now just brings it down to the difference between the domain user and TestUser. Here my knowledge of the intricacies of Active Directory and GPOs is a bit lacking, so this may or may not be a sensible suggestion, but is it possible that some domain security policy is preventing you from modifying the TERRA\JICSvcAdmin profile?

    As a potentially useful (if slightly bizarre) test, if you log on as TERRA\JICSvcAdmin, change the wallpaper, then log off and log back on, is that change retained?

    Rob
    Robert Chipperfield
    Red Gate
  • This could be a group policy issue. Could you please explain to me what the application is attempting to change on the profile? I will then comb through out group policy settings with my systems administrator to see what might be causing the issue.

    Your bizarre test :) will work because profiles can be changed when they are active. Some group policies deny modification of profiles if they are not the active profile.
  • Hi Joe,

    When you start profiling in IIS5, we attempt to set two environment variables (COR_PROFILER and COR_PROFILING_ENABLED) in the profile of the user that ASP.NET runs as. This is done whilst logged on as a batch job. After profiling is complete, we remove these again.

    Hope that helps,
    Rob
    Robert Chipperfield
    Red Gate
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Specifically, Profiler logs in as ASPNET (or whatever account you had configured) and modifies the registry:

    HKEY_USERS\<SID of the user>\Environment

    It creates COR_ENABLE_PROFILING (reg_dword) value 1
    COR_PROFILER (reg_sz) the GUID of RedGate.Profiler.Core2.dll, which is a COM component.

    If Profiler's batch logon to do this work logs in, changes the profile, and logs out again, I'd imagine that on a mandatory profile these changes would be lost before Profiler starts the web application, and that would mean that the RedGate.Profiler.Core2.dll is never loaded into the application and you see the dreaded 'waiting for connection' in the lower left corner forever. Changes to mandatory profiles are thrown away when the user logs out.
Sign In or Register to comment.