I'm upgrading Asp.net Webapi project to .net 4.7.2 from .net 4.6.2 framework and also changing existing project format to MsBuild 15 format.

On local dev machine it works fine with out any issue.

My application is deployed on Azure webapp. When try to access my webapi I'm getting error.

  1. failed to start process with commandline 'dotnet .\WebApplication6.dll', ErrorCode = '0x80004005'.

  2. I'm using elmah in existing project. I'm also seeing issue ConfigurationErrorsException.

    Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified.
      at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)
      at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, Boolean checkAptcaBit)
      at System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement)
      at System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement)
      at System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList)
      at System.Web.HttpApplication.GetModuleCollection(IntPtr appContext)
      at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
      at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
      at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
      at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
    
      Could not load file or assembly 'Elmah' or one of its dependencies. 
      The system cannot find the file specified.
      at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
      at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
      at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
      at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
      at System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase)
    

I did not find any useful resources to convert to .net 4.7.2 and ms build 15 project format.

propertygroup

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<ProjectId>test</ProjectId>
<version>1.0.0</version>
<TargetFrameworks>net472</TargetFrameworks>
<TargetFramework>net472</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<OutputType>Library</OutputType>
<OutputPath>bin\</OutputPath> 
<RunCommand>$(MSBuildExtensionsPath64)\..\IIS Express\iisexpress</RunCommand>
<RunArguments>/path:"$(MSBuildProjectDirectory)" /port:52451</RunArguments>
</PropertyGroup> 
</Project>

Web.config

  <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />

  <aspNetCore processPath="dotnet.exe" arguments=".\WebApplication6.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" />

Global.asax

public class WebApiApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();
        GlobalConfiguration.Configure(WebApiConfig.Register);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
    }
}

I'm trying to understand whether my approach is correct or not. Can I convert project to Ms Build 15 format and use .net framework 4.7.2 with out using asp.net core and deploy on to Azure web app?

Once I publish to azure webapp above web.config lines are added by default. Not sure why those lines are adding unless I'm referencing .net core.

0

There are 0 best solutions below