mr mann's mishmash

it's just a game of give and take…

I was trying to access my local web service this morning and was getting back the dreaded, generic "Server Application Unavailable" each time I hit the service via my code or browser.

For Example:

http://localhost/mywebservice/endpoint.svc

 

Resulted in:

Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.

 

Recorded in the eventlog:

Event Type: Error
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1084
Date: 29/09/2008
Time: 10:14:22
User: N/A
Computer: –PRIVATE–
Description:

aspnet_wp.exe could not be started. The error code for the failure is C0000142. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.

 

Solution?

Try reinstalling ASP.NET (2.0.50727) to refresh the ASP.NET settings, config, metabase and security/worker accounts on the local machine:

  1. Open a command prompt and….
  2. Stop IIS: iisreset /stop
  3. Change to the .NET Framework 2.0 root directory: C:\windows\Microsoft.Net\Framework\v2.0.50727\
  4. Reinstall ASP.NET 2.0 by using the following command: aspnet_regiis -i
  5. Start IIS again: iisreset /start
  6. Try to access your web page again.

Note: there are many other fabulous options available to refresh your IIS settings… just give aspnet_regiis /? a run!

 

This is a cross post from my EMC blog, mainly for backup duplicity and to aggregate some of my past postings. My EMC blog used to be under the Conchango brand but was acquired by EMC so I’ve also retrospectively refreshed some of the old links and maybe a tweak a bit of content too.
permalink to the original post here

It’s fast approaching the time for another meeting of the Silverlight UK User Group. The third session planned for  Wednesday, 1st October 2008! The event starts at 18:30 and will be hosted by Conchango at  Notcutt House (nr Southwark Bridge).

Full Address: Conchango, Notcutt House, 36 Southwark Bridge Road, London, SE1 9EU.

The event might be a bit shorter than usual, probably testament to the fact that the Microsoft team are incredibly busy finishing off the Silverlight build as well as those waiting/upgrading in anticipation to get our hands on it!

AGENDA

Welcome/Kick off

Silverlight, XNA and Gaming (part I)
Richard Costall and Pete McGann
Matthew Smith did it in 6 weeks in the early 80′s, now over 20 years later Pete McGann and Richard Costall have built Manic Miner in .NET, with an engine which works for Silverlight and also XNA. In this session Pete and Rich, talk about the .NET engine, implementations and issues on the two platforms – before Pete steps up to take the ultimate gaming challenge…
more…

Pizza and beer.. a chance to recharge and discuss in the interlude.

Silverlight, XNA and Gaming (part II)
Conclude the presentation and questions.

Showcase (TBD) or Open discussion to finish.


Want to join the discussion?
The event is geared to please/interest/inform both developers and designers alike, so if you are interested in coming along then please contact either myself or Michelle Flynn (here) will be glad to take your details.

Want to present or showcase?
We are always on the lookout for presenters for future sessions – whether it be a high or low level coding walk through, a workflow perspective or showcase demo. If you think that you have a topic/presentation that ought to be shared with the community then please contact me (here) and I’ll see if I can get you scheduled in!

Hope to see you there!

mark.

This is a cross post from my EMC blog, mainly for backup duplicity and to aggregate some of my past postings. My EMC blog used to be under the Conchango brand but was acquired by EMC so I’ve also retrospectively refreshed some of the old links and maybe a tweak a bit of content too.
permalink to the original post here

Loading and resolving assemblies

Comments off

We’ve been writing a tool on our project that requires late-binding to classes/types in our service layer. It’s typical plugin style coding, similar to how much of the various Microsoft Enterprise Library modules are meant to be loaded when needed.

One of the questions raised was what happens if the assemblies containing our classes/types are not in the execution path? This usually occurs when the requested assembly has a dependency on another assembly.

After some playing about with explicitly loading assemblies into the current AppDomain, I found a couple of useful events; AssemblyLoad and AssemblyResolve. The real saviour is AssemblyResolve – hook this up up in your plugin loading code and they it gives you a chance to handle when the requested assembly fails to load. Both these events hang off the AppDomain.CurrentDomain and so catch any assembly load/failure that occurs within execution scope.

In the sample below, I’ve assumed that we know what the path to the assemblies are by setting a constant (if you don’t know this you’ll either have to set some predetermined hint paths or ask for user input). It’s here that the AssemblyResolve event can piece together the missing assembly path, load it and continue.

   1: const string assemblyPath = @"C:\LoadingAssemblies\Model\ParentAssembly\bin\Debug\";
   2:  
   3: private void LoadTest()
   4: {
   5:  
   6:     AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
   7:     AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
   8:  
   9:     Assembly pluginAssembly = Assembly.LoadFrom(string.Format(@"{0}\{1}", assemblyPath, "PluginAssembly.dll"));
  10:  
  11:     Type myType = pluginAssembly.GetType("PluginAssembly.ParentClass");
  12:     if (myType != null)
  13:         Debug.WriteLine(string.Format("{0} -- {1}", myType.FullName, myType.AssemblyQualifiedName));
  14:  
  15:     //fails since it is not defined in this assembly and does not have a full assembly definition
  16:     myType = Type.GetType("ChildAssembly.ChildClass");
  17:     if (myType != null)
  18:         Debug.WriteLine(string.Format("{0} -- {1}", myType.FullName, myType.AssemblyQualifiedName));
  19:  
  20:     //succeeds since we have the full definition - will fire the AssemblyResolve event which points to the assembly location
  21:     myType = Type.GetType("ChildAssembly.ChildClass, ChildAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
  22:     if (myType != null)
  23:         Debug.WriteLine(string.Format("{0} -- {1}", myType.FullName, myType.AssemblyQualifiedName));
  24:  
  25:     //fails since it is not defined in this assembly and does not have a full assembly definition
  26:     myType = Type.GetType("SubAssembly.SubClass");
  27:     if (myType != null)
  28:         Debug.WriteLine(string.Format("{0} -- {1}", myType.FullName, myType.AssemblyQualifiedName));
  29:  
  30:     //succeeds since we have the full definition - since the assembly is in the app path it will automatically load
  31:     myType = Type.GetType("SubAssembly.SubClass, SubAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
  32:     if (myType != null)
  33:         Debug.WriteLine(string.Format("{0} -- {1}", myType.FullName, myType.AssemblyQualifiedName));
  34:  
  35:     //fails because we need to fully qualify the namespace of the class
  36:     myType = Type.GetType("SubClass, SubAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
  37:     if (myType != null)
  38:         Debug.WriteLine(string.Format("{0} -- {1}", myType.FullName, myType.AssemblyQualifiedName));
  39:  
  40: }
  41:  
  42: static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
  43: {
  44:     Debug.WriteLine(string.Format("CurrentDomain_AssemblyResolve reports that '{0}' was unresolved.", args.Name));
  45:  
  46:     // args.Name == "ChildAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
  47:     string[] parts = args.Name.Split(',');
  48:     if (parts.Length > 0)
  49:     {
  50:         Assembly assembly = Assembly.LoadFrom(string.Format(@"{0}\{1}.dll", assemblyPath, parts[0].Trim()));
  51:         return assembly;
  52:     }
  53:  
  54:     return null;
  55: }
  56:  
  57: static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
  58: {
  59:     Debug.WriteLine(string.Format("CurrentDomain_AssemblyLoad reports that '{0}' was loaded.", args.LoadedAssembly.FullName));
  60: }

 

This is a cross post from my EMC blog, mainly for backup duplicity and to aggregate some of my past postings. My EMC blog used to be under the Conchango brand but was acquired by EMC so I’ve also retrospectively refreshed some of the old links and maybe a tweak a bit of content too.

permalink to the original post here