Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Error migrating from version 7.0 to 8.1 #8477


User avatar
0
oaalvarado created

Hi,

I have the application with version 7.0 running on an IIS virtual directory. I changed the appsettings.json so the "WebSiteRootAddress": "http://localhost:80/cpms/", also this files CPMS.Web.Mvc\Views\Account\Login.cshtml and CPMS.Web.Mvc\Areas\App\Views\Layout\Default_Layout.cshtml so they would use the directory \cpms. And updated the path in several CSS files. The application is working fine.

I tried to update to version 8.1, but can't make it to work on a virtual directory. I have changed the path in the Login.csthml, and the Layout.cshtml, but I'm getting errors when the application is trying to access de api's. It doen't use the directory \cpms.

I can't figure out where to update the application so the api's use the correct URL.

Thanks for any help you can provide.


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    As far as I know, the asp net core application does not support IIS virtual directories.

    https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#virtual-directories

  • User Avatar
    0
    oaalvarado created

    Hi @maliming,

    Thanks for your reply. You're right, but I managed to make it work with your suggestions from this question. https://support.aspnetzero.com/QA/Questions/7243

    It was working fine with version 7.0. But now it doesn't with version 8.1. What I found is that the abp.appPath doesn't get the directory in the new version.

    This is with version 7.0:

    And this with version 8.1:

    So I was wondering what changed?

  • User Avatar
    0
    oaalvarado created

    I'm trying to deploy to a sub application, same result.

  • User Avatar
    0
    maliming created
    Support Team

    hi

    Many layout pages have the following code.

    var abp = abp || {}; abp.appPath = '@ApplicationPath';
    

    The ApplicationPath property may have change in net core 3.1. Can you try to change ApplicationPath to your virtual directory path? Or replace it with a new property(VirtualDirectoryApplicationPath). eg

    public abstract class MyAppRazorPage<TModel> : AbpRazorPage<TModel>
    {
    	[RazorInject]
    	public IAbpSession AbpSession { get; set; }
    
    	protected MyAppRazorPage()
    	{
    		LocalizationSourceName = MyAppConsts.LocalizationSourceName;
    	}
    
    	public new string ApplicationPath
    	{
    		get
    		{
    			var appPath = Context.Request.PathBase.Value;
    			if (appPath == null)
    			{
    				return "/";
    			}
    
    			appPath = appPath.EnsureEndsWith('/');
    
    			return appPath;
    		}
    	}
    }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because of no recent activity. Please create a new issue if you are still having this problem.