salimander
  • Posts: 9
  • Joined: 24/05/2016
Still getting that error :|

-deleted and redeployed sql database
-downloaded from YAF-v2.3.3.0-install.zip (btw sample application vb.net is giving a 404)
-set-up (azure) web.config etc.
-using web deploy in visual studio
-ran through install routine


Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidCastException: Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings'.]
YAF.Core.HttpApplicationStateBaseExtensions.GetOrSet(HttpApplicationStateBase httpApplicationState, String key, Func`1 getValue) +272
YAF.Core.CurrentBoardSettings.get_Instance() +74
YAF.Core.Modules.ServicesModule.<RegisterServices>b__3(IComponentContext k) +46
Autofac.<>c__DisplayClass10`1.<Register>b__f(IComponentContext c, IEnumerable`1 p) +10
Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
Autofac.Core.Resolving.InstanceLookup.Execute() +48
Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44

[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings'. (See inner exception for details.)]
Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112
Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +109
Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
YAF.Core.AutoFacServiceLocatorProvider.Get(Type serviceType) +72
YAF.Types.Interfaces.IServiceLocatorExtensions.Get(IServiceLocator serviceLocator) +76
YAF.Types.Interfaces.IServiceLocatorExtensions.Get(IHaveServiceLocator haveLocator) +77
YAF.Core.Services.Logger.YafDbLogger.Log(String message, EventLogTypes eventType, String username, String source, Exception exception) +679
YAF.Core.ServiceLocatorEventRaiser.RaiseIssolated(T eventObject, Action`2 logExceptionAction) +361
YAF.Core.Services.InstallUpgradeService.UpgradeDatabase(Boolean fullText, Boolean upgradeExtensions) +254
YAF.Install._default.Wizard_NextButtonClick(Object sender, WizardNavigationEventArgs e) +1607
System.Web.UI.WebControls.Wizard.OnNextButtonClick(WizardNavigationEventArgs e) +111
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +406
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +114
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +260
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639
tha_watcha
  • Posts: 4037
  • Joined: 06/03/2010
I try to reproduce the error but on a new install with a clean database the error will not occur because the code is not executed. The only possiblity is that you run the install wizard before and the database you use is not empty.
UserPostedImage
bbobb
  • Posts: 1558
  • Joined: 21/10/2008
Originally Posted by: salimander


bbobb: what might the solution to that be?


Most probaly, this piece of code causes the problem. At least, after this it will be clear where exactly the problem is.
Quote:

if (prevVersion < 49)
{
// Reset The UserBox Template
this.Get<YafBoardSettings>().UserBox = Constants.UserBox.DisplayTemplateDefault;


((YafLoadBoardSettings)this.Get<YafBoardSettings>()).SaveRegistry();
}


what is
select * from yaf_registry where name = ' versionname' ?
or execute this: select * from registry_list('versionname')
You should set your db prefixes into the object names. like dbo.yaf_registry list.
salimander
  • Posts: 9
  • Joined: 24/05/2016
Watcha:
I did a clean install with a newly deployed database; the install routine worked until hitting:

Exception Details: System.InvalidCastException: Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings'

I ran the install routine a second (third etc.) time with a partially populated database, and it throws:

There is already an object named 'yaf_drop_defaultconstraint_oncolumn' in the database.

Which can be expected as on error or install it doesnt roll back, delete previous, or check for partaially installed tables.

bbobb:
Sorry, I'm too much of a YAF-noob to spot why that is an error, where to find it, and what to change it to. Can you be a bit more specific of what I need to copy and paste to where? Also my C# isn't that good; it isnt my first language.
Zero2Cool
  • Posts: 1077
  • Joined: 26/04/2011
Originally Posted by: salimander

Watcha:
I did a clean install with a newly deployed database; the install routine worked until hitting:

Exception Details: System.InvalidCastException: Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings'

I ran the install routine a second (third etc.) time with a partially populated database, and it throws:

There is already an object named 'yaf_drop_defaultconstraint_oncolumn' in the database.

Which can be expected as on error or install it doesnt roll back, delete previous, or check for partaially installed tables.

bbobb:
Sorry, I'm too much of a YAF-noob to spot why that is an error, where to find it, and what to change it to. Can you be a bit more specific of what I need to copy and paste to where? Also my C# isn't that good; it isnt my first language.



If it's saying there already is an object there, that would somehow mean it wasn't a completely fresh install. I'm not familiar with Azure setups, but I would use a fresh new database with a name I haven't chosen before and give it that a try.
bbobb
  • Posts: 1558
  • Joined: 21/10/2008
Originally Posted by: salimander


bbobb:
Sorry, I'm too much of a YAF-noob to spot why that is an error, where to find it, and what to change it to. Can you be a bit more specific of what I need to copy and paste to where? Also my C# isn't that good; it isnt my first language.


You need to run the sql script I have posted. If something can be fixed it will be fixed without you. It's just required to spot the place, because it normally can't be reproduced.

tha_watcha
  • Posts: 4037
  • Joined: 06/03/2010
Ok I updated the downloads for the install packages again, now the installation should work.
UserPostedImage
ørekrenkelse
  • Posts: 3
  • Joined: 18/06/2019
I know I'm 3 years late, but I'm having the exact same issue. Completing the install wizard (clicking next and waiting for it to install) results in either Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings' or No candidates for a guest were found for the board 1.. Stack traces are same as posted by OP.
tha_watcha
  • Posts: 4037
  • Joined: 06/03/2010
Originally Posted by: ørekrenkelse

I know I'm 3 years late, but I'm having the exact same issue. Completing the install wizard (clicking next and waiting for it to install) results in either Unable to cast object of type 'YAF.Classes.YafBoardSettings' to type 'YAF.Core.YafLoadBoardSettings' or No candidates for a guest were found for the board 1.. Stack traces are same as posted by OP.



I think i found the problem, can you re-download the packages and try again. You need to clear the database!

https://github.com/YAFNE...T/releases/tag/v2.2.4.17 
UserPostedImage
ørekrenkelse
  • Posts: 3
  • Joined: 18/06/2019
Thank you for your fast response! I get the same issue during the installation, unfortunately. Every time the install fails I delete the database resource in Azure and create a new.

If it's of any relevance I am publishing to my Azure app service from Visual Studio (can't connect via FTP) using the Connected Services feature. I've set up an ASP.NET Web Application (C#) solution and added the .zip content to a project in that solution. I don't know if this affects the installation in any way...
tha_watcha
  • Posts: 4037
  • Joined: 06/03/2010
Did you download the install package?
UserPostedImage
ørekrenkelse
  • Posts: 3
  • Joined: 18/06/2019
Yes, from the link you provided
tha_watcha
  • Posts: 4037
  • Joined: 06/03/2010
Atleast on my tests it works as expected. Are you using the recommended azure web.config?
UserPostedImage
Forum Jump  
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved