salimander
2016-06-09T15:08:27Z
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
2016-06-10T06:40:56Z
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
  •  bbobb
  • 100% (Exalted)
  • YAF Developer
2016-06-10T13:16:46Z
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
2016-06-10T15:56:05Z
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
2016-06-10T17:05:19Z
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
  •  bbobb
  • 100% (Exalted)
  • YAF Developer
2016-06-10T23:20:00Z
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
2016-06-11T18:05:24Z
Ok I updated the downloads for the install packages again, now the installation should work.
UserPostedImage
ørekrenkelse
2019-06-18T09:21:11Z
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
2019-06-18T17:04:50Z
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
2019-06-19T09:26:15Z
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
2019-06-20T03:14:24Z
Did you download the install package?
UserPostedImage
ørekrenkelse
2019-06-20T06:06:22Z
Yes, from the link you provided
tha_watcha
2019-06-20T11:29:12Z
Atleast on my tests it works as expected. Are you using the recommended azure web.config?
UserPostedImage
Alexandir
2019-11-17T18:32:33Z
tha_watcha
2019-11-18T03:48:54Z
Originally Posted by: Alexandir 

I'm having the same problem



Did you install the latest version 2.30? The problem should be fixed.
UserPostedImage

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