+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Resources problem with the Jobs-Intermediate sample.

Resources problem with the Jobs-Intermediate sample.

5 posts, 0 answered
  1. F
    F avatar
    34 posts
    Registered:
    15 Mar 2011
    28 Mar 2011
    Link to this post
    Hello,

    I used the Jobs-Intermediate module in a sample website.
    It works fine as long as I don't reset IIS or change something in the module.
    If i do, I get an error message as if the JobsResources was not registered :
    "

    Could not find the specified key "FirstName" or class id "JobsResources".

    "
    If I uninstall and reinstall the module again, it works fine until the next IIS reset or the next change in the module.
    I checked where the Resource class is registered, it 's inside the "Initialize" method of the module.

    Can you see a reason why the resource registration is forgotten after a IIS reset or a change in the module?

    Thank you,
    F.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    31 Mar 2011
    Link to this post
    Hi F,

    Can you please let us know what is the start up method of your custom module? It seems that when the application is restarted the resources are not properly registered. Can you please try with OnApplicationStart?

    Kind regards,
    Radoslav Georgiev
    the Telerik team
  3. Bobby
    Bobby avatar
    56 posts
    Registered:
    11 Feb 2009
    12 May 2011
    Link to this post
    Hi,

    Has anyone figured out this issue? I am having the same problem. When the module was initally installed it worked correctly. When I rebuilt the application and cause the web app to restart, the resources error explained previously appeared. What do you mean when you say have the resources registered in OnApplicationStart? Is that a method that you override in the custom module? I've read in other form threads and documentation that resources should be registered in the Custom module's Initialize method by calling Res.RegisterResource<CustomModule>(). Is that not entirely correct?

    Thanks for your help,
    Bobby
  4. Bobby
    Bobby avatar
    56 posts
    Registered:
    11 Feb 2009
    12 May 2011
    Link to this post
    Here is some more information. I see there are two threads related to the same issue, So, I am responding to both threads. http://www.sitefinity.com/devnet/forums/sitefinity-4-x/sdk/jobs-module-resources-error.aspx

    Hi all,

    I am experiencing the same issues as Ancuta Me. It seems like on the application restart my resource is not getting registered properly after rebuilding the custom module. Before I did the rebuild, I set a breakpoint in the intialize method of my custom module to make sure my resource was registered. Everything worked fine. Then I added a space to the markup and rebuilt the custom module. I deployed my custom module .dll to the bin directory of the web app. I added a space to the web.config and saved the file to force a restart of the web app. Then an error message gets thrown. Like I said earlier, I called

    Res

     

     

    .RegisterResource<CustomModule>(), in the initialize method as stated in this thread.

    So, my question is how do resources get loaded on a web app restart. Because, I have a breakpoint set in a static constructor for my custom module and that break point never gets hit. The exception is thrown before it hits my breakpoint. Any help is appreciated.

    Thanks,
    Bobby

     

  5. Bobby
    Bobby avatar
    56 posts
    Registered:
    11 Feb 2009
    13 May 2011
    Link to this post
    Hi all,

    I have managed to clear up my issues but I have not pinpointed the root cause of my original problem. The only difference that I noticed between my old module and the Jobs Module was the following two items. The first item is the following method:

    private

     

     

    void InstallCustomVirtualPaths(SiteInitializer initialzer)

     

     

    {


    var

     

     

    virtualPathConfig = initialzer.Context.GetConfig<VirtualPathSettingsConfig>();

     

     

     

     

    var questionTemplatesModuleVirtualPathConfig = new VirtualPathElement(virtualPathConfig.VirtualPaths)

     

     

    {

     

    VirtualPath = Jobs

     

    Module.VirtualPath + "*",

     

     

    ResolverName =

     

    "EmbeddedResourceResolver",

     

     

    ResourceLocation =

     

    "Jobs"

     

    };

     

     

    if (!virtualPathConfig.VirtualPaths.ContainsKey(QuestionTemplatesModule.VirtualPath + "*"))

     

     

        virtualPathConfig.VirtualPaths.Add(questionTemplatesModuleVirtualPathConfig);

    }

    The method was called as followed:

    public

     

     

    override void Install(SiteInitializer initializer)

     

     

    {

     

     

     

    base.Install(initializer);

     

     

     

     

    this.InstallCustomVirtualPaths(initializer);

     

     

    }


    In addition, the following documentation seems to state that your custom resource file should be located in a directory name Localization. Sitefinity staff, is this required? Does the resource file have to be in a directory called Localization?

    http://www.sitefinity.com/40/help/developers-guide/how-to-how-to-create-a-custom-content-based-module-localization.html

    So what I did was created a new custom module and carefully followed the Jobs Module sample and included the above items. This seemed to work and resolve my issues. I have been trying to reproduce the original problem but I have not be able to so far. Unfortunately, I erased my project with the problems. I will spend some time trying to reproduce the issue but just in case I can't, if you carefully follow the Jobs Module example, you should be fine. Hope this helps someone or helps pinpoint the orginal issue from this thread.
5 posts, 0 answered