Skip to content

Publishing app from Visual Studio 2022 #4875

Closed

Description

@itg-assistant

Rusty Elston asked 2025-10-03 13:04:10 UTC

I developed a test app and published it to Mocha Host successfully last year and all went well.

I've now developed a small app and am trying to publish it to Mocha Host, but I keep getting an error messages.  My latest is an IIS 502.5 Process Failure.

My app doesn't appear to even begin...

On my PC, the app compiles without error and runs well.

Any suggestions are appreciated.

Activity

  1. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Julie (ITG) answered 2025-10-03 13:57:08 UTC

    Here are some things you can try:

    1.Check the Event Viewer / stdout logs on the server
    On your MochaHost deployment, go into your published folder.
    In web.config, make sure you have logging enabled:

    
    

    Create a logs folder in the root with write permissions.
    Then try hitting your app again — it should generate a .log file with the real startup error.

    2.Check the Target Runtime
    Did you publish as Framework-Dependent or Self-Contained?
    Shared hosting (like MochaHost) usually does not have .NET runtime pre-installed, or may not have the same version as your dev PC.
    To be safe, publish as Self-Contained Deployment:

    dotnet publish -c Release -r win-x86 --self-contained true
    

    (or win-x64 depending on host environment)
    Then upload the entire publish folder, including all .dlls and .exe.

    3.Check for Missing Files
    Sometimes FTP doesn’t push all files (especially hidden ones). Re-upload the publish folder fresh.
    Make sure web.config is present.

    4.Check .NET Version Compatibility
    If you built with .NET 8, but MochaHost only supports up to .NET 6 (example), a framework-dependent app won’t run.
    Either:
    Switch your app’s target to a supported version in csproj.
    Or deploy self-contained.

  2. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Rusty Elston answered 2025-10-06 12:43:05 UTC

    how do I execute your suggestion:

    dotnet publish -c Release -r win-x86 --self-contained true

    ?

  3. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Julie (ITG) answered 2025-10-06 13:39:51 UTC

    You need to open the terminal in Visual Studio. You can do this by going to “View” on the top menubar, then “Terminal”. Then type the command in the terminal and hit enter.

  4. itg-assistant commented on Jun 16, 2026

    @itg-assistant
    Author

    Julie (ITG) answered 2025-10-06 13:47:00 UTC

    Also note that if you’re targeting multiple frameworks (ie net 8 and net 48) you’ll need to specify which framework to build for.
    Here’s an example with net48: dotnet publish -c Release -r win-x86 -f net48 –self-contained true
    Here’s an example with net 8: dotnet publish -c Release -r win-x86 -f net8.0 –self-contained true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions