ShallContext Parameter name: source

Topics: Troubleshooting
May 25, 2012 at 2:05 PM

I have developed an issue with Orchard afer disabling a module in the admin panel.

The error is:

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: source

Source Error: 

Line 239:        void ActivateShell(ShellSettings settings) {
Line 240:            // look for the associated shell context
Line 241:            var shellContext = _shellContexts.FirstOrDefault(c => c.Settings.Name == settings.Name);
Line 242:
Line 243:            // is this is a new tenant ?

 

How can I go about fixing this?

Coordinator
May 26, 2012 at 6:57 AM

Try to delete mappings.bin and cache.dat in your app_data and app_data\sites\default

Sep 1, 2012 at 2:31 PM
Edited Sep 6, 2012 at 3:32 PM

    I meet this problem today also. After referring to http://orchard.codeplex.com/discussions/370204 and http://orchard.codeplex.com/discussions/256924. I have solved this problem now.

    This is my work:

When clicking feature Enable of a WCF module I create, the above exception appears:

行 240:        void ActivateShell(ShellSettings settings) {
行 241:            // look for the associated shell context
行 242:            var shellContext = _shellContexts.FirstOrDefault(c => c.Settings.Name == settings.Name);
行 243:
行 244:            // is this is a new tenant ? or is it a tenant waiting for setup ?

源文件: D:\Documents\Projects\CMS\Orchard\src\Orchard\Environment\DefaultOrchardHost.cs    行: 242 

    In the log file in ~\src\Orchard.Web\App_Data\Logs, the following message is found:

2012-09-01 20:51:16,750 [18] Orchard.Environment.DefaultOrchardHost - A tenant could not be started: Default

System.ArgumentException: 已经添加过包含已解析虚拟路径“~/wcfservices/gpsdatauploadservice”的路由。

This means a route with the resolved virtual path "~/wcfservices/gpsdatauploadservice" has already been added.

    By modifying and saving the root Web.config, then refreshing the web site, it recovers. But if enable the feature again, the exception appears also.

Having referred to http://orchard.codeplex.com/discussions/256924, I  make ServiceRoute object a static object by changing

 

public IEnumerable<RouteDescriptor> GetRoutes()
        {
            return new[] {
                new RouteDescriptor {
                    Priority = 5,
                    Route = new ServiceRoute(
                                      @"wcfservices/gpsdatauploadservice",
                                      new OrchardServiceHostFactory(),
                                      typeof(IGPSDataUploadService))
                }
            };
        }

 

to

 

private static ServiceRoute m_Route = new ServiceRoute(
                                      @"wcfservices/gpsdatauploadservice",
                                      new OrchardServiceHostFactory(),
                                      typeof(IGPSDataUploadService));

        public IEnumerable<RouteDescriptor> GetRoutes()
        {
            return new[] {
                new RouteDescriptor {
                    Priority = 5,
                    Route = m_Route
                }
            };
        }

Then I save and compile the project, and try to enable and disable the feature again and again, the exception doesn't appear any more.