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

Forums / General Discussions / Return code 0

Return code 0

11 posts, 0 answered
  1. Rakesh
    Rakesh avatar
    72 posts
    Registered:
    11 Jan 2011
    10 Aug 2011
    Link to this post
    I am using SF4.1.I got an error while creating new page.When I publish the page a popup opens which says
    "Return code 0".
    In the "Net" of firebug an error is their.

    "Reload the page to get source for: http://localhost:2175/CorrectCareSolutions/Sitefinity/Services/

    Pages/PagesService.svc/00000000-0000-0000-0000-000000000000/?itemType=Telerik.Sitefinity.Pages.Model.

    PageNode&providerName=&managerType=Telerik.Sitefinity.Modules.Pages.PageManager&provider=&workflowOperation="

    I searched a lot and saw that many people got this error.but I can't find any solution in all that threads.
    Can you please help me?Its very urgent

    Please....
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Aug 2011
    Link to this post
    Hi Rakesh,

    Please enable service tracer that will catch the actual error you are getting. Return code 0 means issue with the service itself or there is a server side error.



    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Rakesh
    Rakesh avatar
    72 posts
    Registered:
    11 Jan 2011
    10 Aug 2011
    Link to this post
    hi,

    I added the code in my web.config as

    <configuration>
      <system.diagnostics>
        <trace autoflush="true" />
        <sources>
          <source name="System.ServiceModel"
                  switchValue="Information, ActivityTracing"
                  propagateActivity="true">
            <listeners>
              <add name="sdt"
                  type="System.Diagnostics.XmlWriterTraceListener"
                  initializeData= "SdrConfigExample.e2e" />
            </listeners>
          </source>
        </sources>
      </system.diagnostics>
    </configuration>
    but their is nothing else other than the "Return code 0".
    what else I do ?
    Thanks for your fast response
  4. Mark
    Mark avatar
    147 posts
    Registered:
    01 Jun 2010
    13 Dec 2011
    Link to this post
    I'm having this problem as well. When I try to open a blog post or publish a new one I receive "Return code: 0" in Chrome, and "Return code: 12031" in Internet Explorer.

    Here's part of the log:

    The statement has been terminated.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
       at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
       at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertOrderedLinkTableRows(OID oid, Int32[] insertedIndexes, Object _insertedValues, PreparedStatement psins, Boolean batch, String sql)
    Field: System.Collections.Generic.IList`1[[Telerik.Sitefinity.Security.Model.PermissionsInheritanceMap, Telerik.Sitefinity.Model, Version=4.3.1885.0, Culture=neutral, PublicKeyToken=b28c218413bdf563]] Telerik.Sitefinity.Blogs.Model.Blog.permissionChildren
    Instance: GenericOID@4da9972f Blog content_id=5bc9d52a-9060-4336-9718-869accf42fff
    Link table value[sequence 147]: NewObjectOID@47 classIndex = 66 id = 5 realOID = GenericOID@3199 PermissionsInheritanceMap sf_prmssons_inheritance_map_id=12631
    INSERT INTO [sf_blgs_sf_prmssns_nhrtnce_map]([content_id], [seq], [sf_prmssons_inheritance_map_id]) VALUES (?, ?, ?)
    (set event logging to all to see parameter values) ---&amp;gt; Telerik.OpenAccess.RT.sql.SQLException: Violation of PRIMARY KEY constraint 'pk_sf_blgs_sf_prmssns_nhrtnc_m'. Cannot insert duplicate key in object 'db_owner.sf_blgs_sf_prmssns_nhrtnce_map'. The duplicate key value is (5bc9d52a-9060-4336-9718-869accf42fff, 147).
    The statement has been terminated.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeUpdate()
       at OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeUpdate()
       at OpenAccessRuntime.Relational.metadata.RelationalLinkCollectionField.insertOrderedLinkTableRows(OID oid, Int32[] insertedIndexes, Object _insertedValues, PreparedStatement psins, Boolean batch, String sql)
       --- End of inner exception stack trace ---
       at DynamicModule.ns.Wrapped_OpenAccessBlogProvider_76262db4eb2e47f28bdfcec34dea1b3e.CommitTransaction()
       at Telerik.Sitefinity.Data.ManagerBase`1.SaveChanges()
       at Telerik.Sitefinity.Modules.ContentServiceBase`5.GetChildContentInternal(String parentId, String contentId, String providerName, String version, Boolean published, Boolean checkOut)
       at SyncInvokeGetChildContent(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp;amp; outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp;amp; rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp;amp; rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp;amp; rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</ExceptionString><InnerException><ExceptionType>Telerik.OpenAccess.RT.sql.SQLException, Telerik.OpenAccess.Runtime, Version=2011.2.713.3, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342</ExceptionType><Message>Violation of PRIMARY KEY constraint 'pk_sf_blgs_sf_prmssns_nhrtnc_m'. Cannot insert duplicate key in object 'db_owner.sf_blgs_sf_prmssns_nhrtnce_map'. The duplicate key value is (5bc9d52a-9060-4336-9718-869accf42fff, 147).
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Dec 2011
    Link to this post
    Hi Mark,

    The problem is related to the permission inheritance when you try to create blog/post and the owner is set.

    "Cannot insert duplicate key in object 'db_owner.sf_blgs_sf_prmssns_nhrtnce_map'. The duplicate key value is
    ..."

    The problem is related to the Open Access transaction and it would be better if you open a support request and send your project for further investigation.



    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Juan Sola
    Juan Sola avatar
    28 posts
    Registered:
    08 Jan 2007
    09 Jul 2012
    Link to this post
    What was the conclusion to this? I am having the same troubles, it seems like it is a common issue.
  7. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    12 Jul 2012
    Link to this post
    Hello,

    There was a problem in Sitefinity 4.3 at the time when th thread was started the problem that Mark has described is fixed in Sitefinity 4.4, but the fix for it is either an upgrade to 4.4 or better yet to Sitefinity 5 or running a script that will fix permission inheritance.
    Place the code in the codebehind of a webform and request the form in the browser.
    As the code purpose might differ from your exact problem backup the database of the project before executing in case something goes wrong.

    protected void Page_Load(object sender, EventArgs e)
           {
     
               FixPermissionInheritance(typeof(BlogPost), typeof(BlogPost));
     
           }
     
           private void FixPermissionInheritance(Type parentType, Type childType)
           {
               string transactionName = "InheritanceMapsCleanup" + Guid.NewGuid().ToString();
               IManager pmanager = ManagerBase.GetMappedManagerInTransaction(parentType, transactionName);
               IManager cmanager = ManagerBase.GetMappedManagerInTransaction(childType, transactionName);
     
               string parentTypeVoa = pmanager.Provider.ConvertClrTypeVoaClass(parentType);
               string childTypeVoa = pmanager.Provider.ConvertClrTypeVoaClass(childType);
     
               IQueryable<PermissionsInheritanceMap> maps = this.GetInheritanceMaps(pmanager.Provider).Where(m => m.ChildObjectTypeName == childTypeVoa);
               int deleted = 0;
               foreach (PermissionsInheritanceMap map in maps)
               {
                   object parent = null, child = null, childParent = null;
                   try
                   {
                       parent = pmanager.GetItem(parentType, map.ObjectId);
                       if (parent.GetType().GetInterface(typeof(ISecuredObject).FullName) == null)
                           parent = null;
                   }
                   catch (ItemNotFoundException itemNotFound)
                   {
                       parent = null;
                   }
     
                   try
                   {
                       child = cmanager.GetItem(childType, map.ChildObjectId);
                       if (child.GetType().GetInterface(typeof(ISecuredObject).FullName) == null)
                           child = null;
                       childParent = ResolveChildAssignedParent(child);
                   }
                   catch (ItemNotFoundException itemNotFound)
                   {
                       child = null;
                   }
     
                   //the inheritance map will be cleaned-up if one of the following applies:
                   //1. the parent page does not exist
                   //2. the child page does not exist
                   //3. the map does not represent a real connection between the pages
                   //4. the map is not anymore included in the parent maps (loose)
                   if ((parent == null) || (child == null) ||
                       ((childParent != null)
                           && (((((ISecuredObject)childParent).Id != ((ISecuredObject)parent).Id)) || (((ISecuredObject)childParent).Id != ((ISecuredObject)parent).Id)))
                       )
                   {
                       ISecuredObject parentElements = GetItemsCollection(parentType, pmanager).FirstOrDefault(n => n.PermissionChildren.Contains(map));
                       if (parentElements != null)
                       {
                           parentElements.PermissionChildren.Remove(map);
                       }
                       this.DeletePermissionsInheritanceMap(map, pmanager.Provider);
                       deleted++;
                   }
               }
               //remove duplicate valid maps
               IEnumerable<ISecuredObject> allChildren = GetItemsCollection(childType, cmanager);// cmanager.GetItems(childType, "", "", -1, -1).Cast<ISecuredObject>();
               foreach (ISecuredObject child in allChildren)
               {
                   var parent = ResolveChildAssignedParent(child);
                   if ((parent != null) && (parent is ISecuredObject))
                   {
                       PermissionsInheritanceMap[] parentInheritors = ((ISecuredObject)parent).PermissionChildren.Where(map => map.ChildObjectId == child.Id).ToArray();
                       if (parentInheritors.Length > 1)
                       {
                           for (int i = 1; i < parentInheritors.Length; i++)
                           {
                               ((ISecuredObject)parent).PermissionChildren.Remove(parentInheritors[i]);
                           }
                       }
                       else if (parentInheritors.Length == 1)
                       {
                           IQueryable<PermissionsInheritanceMap> matchingMaps = this.GetInheritanceMaps(pmanager.Provider).Where(map => map.ObjectId == ((ISecuredObject)parent).Id && map.ChildObjectId == child.Id);
                           if (matchingMaps.Count() > 1)
                           {
                               foreach (PermissionsInheritanceMap map in matchingMaps)
                               {
                                   if (map != parentInheritors[0])
                                       this.DeletePermissionsInheritanceMap(map, pmanager.Provider);
                               }
                           }
                       }
     
                   }
               }
               TransactionManager.CommitTransaction(transactionName);
           }
     
           private IEnumerable<ISecuredObject> GetItemsCollection(Type itemType, IManager managerInstance)
           {
               if (itemType == typeof(PageNode))
               {
                   PageManager manager = managerInstance as PageManager;
                   if (manager != null)
                       return manager.GetPageNodes();
                   else
                       return new List<ISecuredObject>();
               }
               else
                   return managerInstance.GetItems(itemType, "", "", -1, -1).Cast<ISecuredObject>();
           }
     
           private object ResolveChildAssignedParent(object child)
           {
               object childParent = null;
               if (child.GetType().GetInterface(typeof(IHasParent).FullName) != null)
                   childParent = ((IHasParent)child).Parent as ISecuredObject;
               if (childParent == null)
               {
                   PropertyInfo parentProperty = child.GetType().GetProperty("Parent");
                   if (parentProperty != null)
                   {
                       childParent = parentProperty.GetValue(child, null);
                   }
               }
               return childParent;
           }
     
           private IQueryable<PermissionsInheritanceMap> GetInheritanceMaps(DataProviderBase dataProvider)
           {
               return SitefinityQuery.Get<PermissionsInheritanceMap>(dataProvider);
           }
     
           private void DeletePermissionsInheritanceMap(PermissionsInheritanceMap map, DataProviderBase dataProvider)
           {
               MethodInfo GetTransaction = dataProvider.GetType().GetMethod("GetTransaction", BindingFlags.NonPublic | BindingFlags.Instance);
               if (GetTransaction != null)
               {
                   SitefinityOAContext context = (SitefinityOAContext)GetTransaction.Invoke(dataProvider, new object[] { });
                   if (context != null)
                   {
                       try
                       {
                           context.Delete(map);
                       }
                       catch
                       {
                           //do nothing
                       }
                   }
               }
           }



    Greetings,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Juan Sola
    Juan Sola avatar
    28 posts
    Registered:
    08 Jan 2007
    13 Jul 2012
    Link to this post
    Just to confirm, will this code fix permission issues with images? Will I need to update the code to fix permission issues with images and not pages?
  9. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    18 Jul 2012
    Link to this post
    Hello,

    It fix all problems related to permission inheritance map for each sitefinity module, but to absolutely sure you have this problem I recommend clearing the logs files (save them at another location) in App_Data/Sitefinity/Logs and recreate the problem with Images. This will create an error log. Review the information in the error log and if you an entry for "prmssns_nhrtnce_map" in the log use the code above to resolve. For images you will have to change the type used to
    FixPermissionInheritance(typeof(Image), typeof(Image));

    Kind regards,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Paolo
    Paolo avatar
    147 posts
    Registered:
    11 Jun 2009
    07 Nov 2013
    Link to this post
    excuse me ,why I don't see any GetInheritanceMaps method?? in which assembly should it be located?
    Thanks
  11. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    30 Nov 2016
    12 Nov 2013
    Link to this post
    Hello,

    GetInheritanceMaps is available for each sitefintiy manager, for example PageManager

    PageManager manager = PageManager.GetManager();
                var maps = manager.Provider.GetInheritanceMaps();
     
    An updated code for fixing this problem is available as attachment in this KB article.

    Regards,
    Stanislav Velikov
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
11 posts, 0 answered