YAFLogo

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago
Can you post your startup.cs, and then i might be able to help?

EDIT:

i marked the 3 lines in the startup which needed to be removed 

https://github.com/YAFNET/YAF.SampleWebApplication/blob/master/YAF.SampleApp/Startup.cs#L81 

https://github.com/YAFNET/YAF.SampleWebApplication/blob/master/YAF.SampleApp/Startup.cs#L127 

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
a month ago
I have commented out those 2 lines in Startup.cs

//endpoints.MapBlazorHub();

//endpoints.MapFallbackToPage("/_Host");

I also needed to add Index Razor pages in similar fashion as in the YAF.SampleApp, because the app would not start with my existing MVC Index view.

 Index Razor pages.PNG You have insufficient rights to see the content.

Now I can run YAF Forums, but my existing app stopped working entirely (even with the simplest controllers without any loggers, identity, etc).

I am attaching my Program.cs and Startup.cs files with added .txt file extension.

 Program.cs.txt You have insufficient rights to see the content. Startup.cs.txt You have insufficient rights to see the content.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago
Well without the source project i cant test this. But it looks like the services.AddControllers(); to ConfigureServices and configure mvc routing in startup.cs is missing...

public void ConfigureServices(IServiceCollection services)
{
    services.AddYafCore(this.Configuration);
    services.AddControllers();
    ...
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ...
    app.UseEndpoints(endpoints =>
    {
        endpoints.MapRazorPages();

        endpoints.MapControllerRoute(
            name: "default",
            pattern: "{controller=Home}/{action=Index}/{id?}");
    });

endpoints.MapAreaControllerRoute(
                name: "default",
                areaName: "Forums",
                pattern: "{controller=Home}/{action=Index}/{id?}");

            endpoints.MapControllers();

            endpoints.MapHub<NotificationHub>("/NotificationHub");
            endpoints.MapHub<ChatHub>("/ChatHub");           
}
McHine
  • McHine
  • 72.4% (Friendly)
  • YAF Forumling YAF Version: 4.0.0 RC4
a month ago
I spent the better part of a week on this. 

(you're all welcome to show me where the door is)

Check my threads here and there are some on github. (i think this forum was upgrading at the time)

as best i can tell the issue is that most apps run program only. YAF needs program and startup, and so a lot of your program setup will need to change.

for example there seems some overlap in your two files that may be causing some of the issues.

fwiw, this is my program.cs

* Yet Another Forum.NET

* Copyright (C) 2003-2005 Bj�rnar Henden

* Copyright (C) 2006-2013 Jaben Cargman

* Copyright (C) 2014-2024 Ingo Herbote

https://www.yetanotherforum.net/ 

*

* Licensed to the Apache Software Foundation (ASF) under one

* or more contributor license agreements.  See the NOTICE file

* distributed with this work for additional information

* regarding copyright ownership.  The ASF licenses this file

* to you under the Apache License, Version 2.0 (the

* "License"); you may not use this file except in compliance

* with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0 

* Unless required by applicable law or agreed to in writing,

* software distributed under the License is distributed on an

* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

* KIND, either express or implied.  See the License for the

* specific language governing permissions and limitations

* under the License.

*/

using YAF.Core.Extensions;

using Autofac;

using Autofac.Extensions.DependencyInjection;

namespace EFMB2;

///

/// Class Program.

///

public class Program

{

    ///

    /// Defines the entry point of the application.

    ///

    ///

    /// The arguments.

    ///

    ///

    /// The .

    ///

    public static Task Main(string[] args)

    {

        var host = Host.CreateDefaultBuilder(args).UseAutofacServiceProviderFactory()

            .ConfigureYafLogging()

            .ConfigureWebHostDefaults(webHostBuilder =>

                webHostBuilder.UseStartup()).Build();

        return host.RunAsync();

    }

}

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago

I spent the better part of a week on this. 

(you're all welcome to show me where the door is)

Check my threads here and there are some on github. (i think this forum was upgrading at the time)

as best i can tell the issue is that most apps run program only. YAF needs program and startup, and so a lot of your program setup will need to change.

for example there seems some overlap in your two files that may be causing some of the issues.

Originally Posted by: McHine 

I am aware of that. However that is needed for Autofaq, it works only with the startup. In the long run the goal is to drop autofaq and use the .net DI but that requires a  lot of refactoring.

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
a month ago
No! @the_watcha, adding .AddControllers() didn’t help.

I guess I can organise providing you my source code and database. But I don’t think this is the way to go. You will need to fix many issues for me starting with using Microsoft Membership Provider instead of YAF one. You said that there is a “guide that covers the basic topic of integrating the forum”, but I couldn’t find it. And I suppose there will be some more hurdles down the track.

In summary:

YAF is a good piece of software, but in my opinion it’s not easy to integrate.

For those who need to have it as stand-alone forum it might be very good, but in my case, it’s proven difficult to be used in conjunction with other systems.

- It might be my fault, my level of experience, but I could not add YAF to my existing app.

That why I am asking:

“If someone successfully integrated YAF with their existing app, could you share your experience!”

- I suspect that the other option (build your own app around YAF solution) will be easier and possible to implement, but in my case its too much efforts and I don’t want to do it.

So, now I am considering using YAF in subdomain as separate app. That will make maintaining and updating YAF easier, but I either have to go

A.) Use two completely independent Membership systems with separate login/registration, UserRoleManagement or

B.) Find way how to use my existing Microsoft Membership Identity system for authentication and authorisation (User and Role Management) in YAF installed in subdomain as stand-alone app.

I guess it will not be a problem to use one and the same SQL database.

@the_watcha, would it be too much to ask you to prepare a sample solutions for the following scenario:

1.)    1.) Main app – build as .NET Core (v. 9) MVC application using Microsoft Membership Identity Provider.

2.)    2.) Subdomain app – YAF.NET v4

3 33.)    Subdomain YAF app using  Microsoft Membership Identity Provider of the main app for ALL Login/Registration, UserRoleManagement, Authorisation & Authentication operations.

4.)    4.) The two apps could use one and the same SQL database.

 

  @the_watcha, I understand that it is not small task to ask you, but …

I stopped being an active developer many years ago. I still could do certain things, but there are some limits of my time and capabilities. The project for which I need YAF.NET is for social community and its not-for-profit. I don’t get any penny out of it and unfortunately, I cannot spend any more time on it as already have. And it seems that this integration proved to be too challenging for me.

In my opinion the option I have suggested, is a viable option of integrating YAF and many could use it. It will help wider usage of YAF.

So, @the_watcha if think that making a sample of such integration will benefit the YAF community, please do it!

If you think that it’s too much or useless I would understand and still be grateful for what you are doing for keeping YAF.NET alive and be in help for so many people.

tha_watcha
  • tha_watcha
  • 100% (Exalted)
  • YAF.NET Project Lead 🤴 YAF Version: 4.0.1 BETA
a month ago
Yes you are right its not easy to integrate, but the issue is not that the basic guide  is not helping or the samples are not enough. The problem is that each site is different and there is not that one solution that works for every site. It doesnt make any sense to create another sample, you would still end up with the same problems.

The only way to help you is to work the other way around, if you can send me your source and the database structure (not the data) i could help you build a solution.

AMtoUseYAF
  • AMtoUseYAF
  • 58% (Neutral)
  • YAF Forumling Topic Starter YAF Version: 4.0.0
29 days ago
The samples and the guides are good and helpful, but as you said because of the variety of how each site is built they cannot be universal and cover all.

My last suggestion about using subdomain was about widening possible scenarios of use. Surely there will be problems, but they would be of different kind and hopefully they would be more easily overcome.

I didn’t want it to ask you to do something specifically for me. I was hoping that my questions, your answers and samples would benefit everyone.

But I gratefully will accept your offer and I will send you private message.