Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jacob phillips 130 posts 372 karma points
    Jun 01, 2013 @ 03:26
    jacob phillips
    0

    /base in Umbraco 4.9.1

    I was using /base in Umbraco 4.0.4.2, after upgrading, none of my base classes work.

    I tried recreated them in VS 2008 with new references.

    When I make a request, I just get:

    500 - Internal server error

     

    with nothing in the event viewer.

     

    Here's a simle example:

    namespace BaseSample
    {
        public class Demo
        {
            public static XPathNodeIterator GetPageData(int id)
            {
                return umbraco.library.GetXmlNodeById(id.ToString());

            }
            public static string Create(int parentid, string name, int year, int month, int day)
            {
                DocumentType dt = DocumentType.GetByAlias("show");
                Document d = Document.MakeNew(name, dt, new umbraco.BusinessLogic.User(0), parentid);
                var displayDate = new DateTime(year, month, day);
                //to modify the document properties....
                d.getProperty("displayDate").Value = displayDate;

                d.Publish(new umbraco.BusinessLogic.User(0));
                d.Save();

                umbraco.library.UpdateDocumentCache(d.Id);
                return d.Id.ToString();
            }
        }
    }

     

    ...and here is my restExtensions.config

     

    <?xml version="1.0" encoding="utf-8"?>
    <RestExtensions>
        <ext assembly="/bin/UmbracoBaseClassLibrary1" type="BaseSample.Demo" alias="mybaseclass">
            <permission method="Create" returnXml="false" allowAll="true" />
        </ext>
    </RestExtensions>

     

    What am I missing?

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jun 01, 2013 @ 18:56
    Jan Skovgaard
    0

    Hi Jacob

    Is there a config file called "BaseRestConfig.config" in your /config/ folder? If I remember correctly this is a refactored version, which should be used now. However the old config you mention above should still be working - but it could be interesting to see if adding the info to the new file fixes the issue because then this might be a bug in 4.9.1

    Is it only when you're trying to call your base stuff that you get the error 500 message? Have you tried having a look in the umbracoLog table to see if it contains some usefull information?

    /Jan

  • jacob phillips 130 posts 372 karma points
    Jun 02, 2013 @ 03:57
    jacob phillips
    0

    Jan,

    There was no config file called "BaseRestConfig.conig" in the config folder. I thought maybe I missed it in my diff of the current folders and from the contents in the .zip install (the 4.9.1 installation files), but it is not in there either. I did notice that is it in the 4.11.8 version. I took that copy and put it in my 4.9.1 install. Here are my contents:

    <?xml version="1.0" encoding="utf-8"?>
    <BaseRestExtensions>
        <!--
        <ext assembly="/bin/UmbracoBaseClassLibrary1" type="BaseSample.Demo" alias="mybaseclass">
            <permission method="Create" returnXml="false" allowAll="true" />
        </ext>
        -->
        <extension alias="mybaseclass" type="UmbracoBaseClassLibrary1.BaseSample.Demo" >
            <method name="Create" allowAll="true" />
        </extension>
        
        <!--
        <extension alias="member" type="Umbraco.Web.BaseRest.MemberRest,umbraco">
            <method name="Login" allowAll="true" />
            <method name="Logout" allowAll="true" />
            <method name="GetCurrentMemberId" allowAll="true" />
            <method name="GetCurrentMember" allowAll="true" />
            <method name="GetCurrentMemberAsXml" allowAll="true" />
            <method name="SetProperty" allowAll="false" />
        </extension>
        -->
        <!--
        <extension alias="umbBlog" type="Runway.Blog.Library.Base,Runway.Blog">
            <method name="CreateComment" returnXml="false" allowAll="true" />
            <method name="GetGravatarImage" returnXml="false" allowAll="true" />
        </extension>
        -->
    </BaseRestExtensions>

    I tried the original formatting of my extension entry and got the same 500 status error (also, nothing in the umbracoLog).

    I then tried changing the format of my extension to match the examples. I ran my base request and got an exception:

     

    FileNotFoundException 
    Could not load file or assembly 'file:///C:\inetpub\wwwroot\capradio\bin\bin\UmbracoBaseClassLibrary1.dll' or one of its dependencies.

     

    So why is it looking in \bin\bin?

    I created a child "bin" folder in \bin and put my .dll in there.

    It almost worked except that my base requests used to publish the autofolders date folders. Now I'm using datefolders package. Now, they are being created but are not being published, but the content node (the id is 4102) is published. however, I am am back to a server 500 error, but the node is in the back office, published, but it's parent day folder (node id= 4103) is not published (but did get created). Here's what's in the umbracoLog

    id    userId    NodeId    Datestamp    logHeader    logComment
    1371846    0    0    2013-06-01 18:38:04.183    Error    Couldn't find any page with the nodeId = 0. This is most likely caused by the page isn't published!  Parameter name: nodeId
    1371847    0    0    2013-06-01 18:38:04.183    Error    Couldn't find any page with the nodeId = 0. This is most likely caused by the page isn't published!  Parameter name: nodeId
    1371848    0    0    2013-06-01 18:38:04.183    Error    Couldn't find any page with the nodeId = 0. This is most likely caused by the page isn't published!  Parameter name: nodeId
    1371845    0    -1    2013-06-01 18:38:04.150    System    Loading content from disk cache...
    1371844    0    4102    2013-06-01 18:38:04.010    Publish   
    1371843    0    4103    2013-06-01 18:38:03.670    New   
    1371842    0    4102    2013-06-01 18:38:03.247    Publish   
    1371841    2    -1    2013-06-01 18:38:03.153    Debug    Xml saved in 00:00:00.0432830
    1371840    0    4102    2013-06-01 18:38:02.980    New   

     

    So to review, why is the path to the .dll required to be in a nested /bin/bin directory?  Second, what is the second parameter in the example extension entries below, the project .dll name and namespace? (e.g. when I add an extension, what am I required to put after the comma? Third, is there something obvious I can to to have the date folders publish, or am I going to have to alter my class to that manually? Thanks for your time.

     

        <extension alias="umbBlog" type="Runway.Blog.Library.Base,Runway.Blog">

     

        <extension alias="member" type="Umbraco.Web.BaseRest.MemberRest,umbraco">
           
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jun 02, 2013 @ 18:34
    Jan Skovgaard
    0

    Hi Jacob

    Ok, if the baseRestExtension.config is not in 4.9 my mind is playing me a trick. Then it probably was first added in 4.10 and then you should be using the restExtensions.config file.

    In the uncommented example in your config above there is a reference to /bin/...but is it also uncommented in the restExtensions.config that IS the one Umbraco is reading? If not that's probably why it gives you the /bin/bin error.

    Try to have a look at your current restExtensions.config file and see if it helps to remove the /bin/ from the path and then delete baseRextExtensions.config and forget all about it for now.

    /Jan

  • jacob phillips 130 posts 372 karma points
    Jun 05, 2013 @ 00:55
    jacob phillips
    0

    It's very strange...

    Before I started this post, none of my /base calls were working. I stripped down my methods to the basic "Create" method above. Still, nothing.

    Then, I copied the "BaseRestExtensions.config" file from 4.11.8 install folders and added my extension.Then, it started working -- sort of, the date folders

    generated by "DateFolders" package were created, but not published.

     

    Next, I came back to your last post telling me, get rid of BaseRestExtensions.config. I thought this was strange because that's where I started. But my basic Create method above is still working (and after moving the "bin" from  /bin/myDLLname.dll, it is indeed looking in the right place.

    I feel like I just went around in a big circle and now I just need to figure out why the folders generated by DateFolders package are not publishing. If a use the /base class to create a type that does not use DateFolders, everything is fine.

    I guess I'll just start a new post. Thanks for your feedback on this, although I'm not really sure why it's working now?!

     

     

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jun 05, 2013 @ 10:56
    Jan Skovgaard
    0

    Hi Jacob

    Hmm, I just checked if the baseRestExtensions.config exists in 4.9 - it does not.

    So I think that the settings you made in restExtensions.config have started working due to a recycling of the app pool or touch in web.config perhaps?

    Simply just forget that we tried to add baseRestExtensions.config :)

    /Jan

  • jacob phillips 130 posts 372 karma points
    Jun 07, 2013 @ 00:39
    jacob phillips
    0

    Ok, Forgotten.

    Yeah, you are probably right. I probably lost track of where I was due to some caching or something. I got so used to recycling the app pool in IIS 6 on the old crappy server since every time I pushed out a change it would practically crash the site. I don't even know if the appPool recycles when I put a new .dll in the bin folder or not....I swear I've noticed that sometimes I have to clear the browser cache, and sometimes I don't each time I make a change and create a new .dll

    Whatever, at least there's ONE PERSON who can bounce reality off of me, so THANKS!!!

    And I have found several other things that were wrong. My issues are now hovering around something in the DateFolders package. I've started a new thread for that so I won't talk about it here anymore.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jun 07, 2013 @ 10:40
    Jan Skovgaard
    0

    Hi Jacob

    Wow that sounds like a weird environment to develop up against! I feel your pain. Happy to see you got it all working even though I tried to confuse you even more along the way ;-)

    Cheers,
    Jan 

Please Sign in or register to post replies

Write your reply to:

Draft