Deploying Blazor to local IIS Express - Error: Duplicate ScriptResourceHandler

Posted by: fleury_darts_05 on 20 December 2022, 4:40 pm EST

  • Posted 20 December 2022, 4:40 pm EST

    I need to deploy a blazor web application to computers that need to run our web app completely disconnected from the Internet running under IIS Express and working with a local database installed on the client machine. I know it sounds peculiar, but please stick with me…

    The blazor app that we’re trying to run locally and disconnected from the Internet normally runs on an Intranet web server and connects to our main production SQL Server. So we cannot customize the web app for MAUI. We want to be able to drop our unmodified blazor app right inside IIS express and it detects that it’s being run from the C:\FSAPublish folder and connects to the local SQL Express database instead of the remote production SQL Server, then the data is synchronized back to the production server when they return to the office with an Intranet connection available. Again, I’ve tried this self-hosting of my blazor app inside IIS Express is working just fine on my dev machine, so I know it can be done. I’m receiving errors on new machines that I try to deploy it to. There’s just some missing piece on the brand new machines that I’m trying to set up. In other words, we want to write our blazor app once but deploy it into two different scenarios (connected with remote SQL Server and disconnected with local SQL Server Express on client machine).

    Our blazor application targets the .NET 6 Framework.

    Deploying and running my blazor application on my development works great using IIS Express (NOT inside visual studio, but actually launched using a batch file containing “start iisexpress /path:C:\FSAPublish”). However, upon deploying to any brand new client workstation with the .NET 6 runtime and IIS Express installed, it fails upon pulling up the edge browser and trying to open URL http://localhost:8080/blank (which works great on my dev machine).

    I’m not sure why the error is mentioning a duplicate scriptResourceHandler in my web.config file, when I don’t even have that in my bare bones blazor web.config file (shown below the error).

    Any help would be appreciated.

    Error message:

    If you see the text “There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined”, this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to “.NET 2”. You can also remove the extra sections from the web.config file.

    <?xml version="1.0" encoding="utf-8"?>
  • Posted 2 January 2023, 9:44 pm EST

    Hi,

    Thank you for your patience on this. As per our understanding, you developed the Blazor application and now you would like to configure this application with two different two SQL Database instances based on Internet Connectivity.

    In this case, you need to add a connection string for both the DBs in the config file and connect to the relative DB based on your condition or IP Addresses/ Domain name.

    Also, you need to sync both the DBs to make the data in sync.

    Also, the Blazor works on Net 6.0, not Framework and it would not have any web.config file. Please check your project again.

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels