Link to home
Start Free TrialLog in
Avatar of rickhill11
rickhill11

asked on

Publish VS Web Site to GoDaddy

I have a very simple web site that I've developed in VS 2019 Community, using C#,  and I want to upload it to GoDaddy's Plesk Windows server.  Have tried a couple of FTP Publishes, and am getting a 500 server error.

Can anyone help me with the steps?

Thanks in advance.
Avatar of David Favor
David Favor
Flag of United States of America image

To answer your question, you'll refer to your logs.

The source/detail of the cause of the 500 is almost always instantly clear from your Webserver logs.

Note: FTP has nothing to do with the problem. You must ssh or otherwise access your Webserver machine to review your logs.
Aside: If you do dev/staging in a different runtime environment, you'll likely always have this sort of problem, because local dev setups rarely match public runtime environments.

So for future work, setup a site like https://dev.yourgreatdomain.com which will change to https://yourgreatdomain.com when you go live.

For all dev/staging projects, I always run the dev/staging site in a 100% identical runtime environment.

In my case, I use LXD, so to create a dev/staging container (bit for bit, 100% identical copy), I just copy a live/production container to a dev/staging container, so I know the Site/App/API begins live at a working starting point.
GoDaddy Note: GoDaddy hosting is known by all as possibly the worst hosting available.

Read through the many EE questions regarding GoDaddy.

What may be required as a first step is the move to different hosting.

First check your Webserver logs + if problem... can't be solved due to using GoDaddy, then your next step will be to change hosting provider.
"500 server error" is due to server got exception or error while processing your request!
Apply try... catch block to get appropriate or actual error from code.


In plesk you can choose faile request tracing or Logs. For logs, just click on the logs icon and that will take you to where your logs are. Run your page once, go to the logs and this may help but Failed Request tracing may give you more detailed data. 
User generated image
If you use faile request tracing, once you click start, you get a pop up, use code 500 at the top. Check the boxs for asp.net and probably the www server as well.  

User generated image

Once you save these settings, go back and run your page one time. Then go back to failed reuqest tracing and you will see a file or files to view. Clicking on those will show you a trace of what has taken place and where the errors are.

Otherwise, you can just enable detailed errors in your web.config
https://talk.plesk.com/threads/detailed-error-messages-not-being-displayed.329422/
Avatar of rickhill11
rickhill11

ASKER

All,

Thanks for the advice.  Tomorrow, hope to have time to follow through.

Rick  
Keeping in mind that I am a old and retired C programmer, and have been pressed into service on this thing; if GoDaddy is the worst, who is the best.  I might add the GoDaddy has been very helpful, EXCEPT when in comes to actually trouble shooting.  They clearly state that is not their problem.  Frankly, I get that, but I need some help, and a web host that offered a little more help would be worth a few more $$$.

Rick 
For windows, I have been using liquidweb for about 10 years because of their outstanding support. The no longer have shared windows hosting,only vps or dedicated. vps runs around $100 per month. One help call when things go wrong pays off. Dedicated is going to be about $300 for windows. It is full service by people that fully understand hosting and servers.

I don't care who you use for shared hosting, when paying $30ish per month is not going to allow for full service support. 
This is the trace, I think:
1. -GENERAL_REQUEST_START
SiteId261
AppPoolIdacscodes.com(domain)(4.0)(pool)
ConnId1610639412
RawConnId0
RequestURLhttp://acscodes.com:80/
RequestVerbGET
16 ms
2. -GENERAL_SEND_CUSTOM_ERROR
HttpStatus500
HttpSubStatus21
FileNameOrURL500.htm
0 ms
3. -GENERAL_REQUEST_END
BytesSent1410
BytesReceived594
HttpStatus500
HttpSubStatus21
FWIW, the tech support guy at GoDaddy was concerned about the way that VS had created a directory structure.

The structure is

Home Directory
  .plesk
   cgi-bin
   error_docs
   httpdocs
      App_Data
      BlazorDebugProxy
      Resources
      wwwroot
         _framework
         css
   logs

There are only three files in the home directory:

----------------------------------------------
Forgive me if I am giving unnecessary information; I am not sure what is relevant and what is ground clutter:
VS divided my Solution into 3 projects:
    xxx.Client
    xxx.Server
    xxx.Shared

It allows me to publish the Client and Server projects to GoDaddy, but when I try to publish the Shared project, it only offers Azure, Docker Container Registry, and Folder (local folder or file share).
One last thing:

I believe that index.html is sort of the first file that is accessed, and the instances of Index.html that I can find on the GoDaddy server is in

Home directory->httpdocs->index.html  ---- this is not a part of my project as far as I can tell

and

HomeDirectory->httpdocs->wwwroot->index.html ---- this file is from my Client project

I wonder if I just need to move the wwwroot directory to the HomeDirectory?
Sorry, this started out as a GoDaddy Linux question, and morphed into a Windows Server question, so there are two threads.  The other is Simple Visual Studio Project C#, publish to a Linux Server 
I think in plesk you need to set your start directory to wwwroot
OK, did that, and now get an interminable "Loading..." message
You asked, "if GoDaddy is the worst, who is the best?"

This is subjective + also relates to expertise level.

My preference is to use a Hosting Provisioner, rather than Hosting Company.

Provisioners provide bare metal = No OS (you install your own). No admin. No help, other than keeping the hardware working.

OVH is my Provider of choice.

High performance, low cost machines, fast networking infrastructure connecting between OVH machines + across the globe.

To determine what my be "Best" for your application.

Likely good to open a new question about this, describing the application in more detail, asking folks how they chosen hosting for similar criteria.
I would think you want server?
I would think you want server? 

Can you clarify.
only the server project to the server
Since the only instance of index.html is in ...Client->wwwroot->index.html, if I only upload the server side, then I wont have index.html.  Are there other startup files that might be used as a starting point?
By default,plesk has your default directory in httpdocs and may please some files there that are not related to your site.

Your directory structure shows a sub closer called wwwroot. I assume that was created by publishing to the web meaning that is where your web files are located.

Look at where and how this is running locally if you are doing that. look at not only the files in the directory, but their contents as well. That will tell you where your start directory needs to be.
So I have been able to get index.html to run.  I doesn't report any errors, or otherwise misbehave.  It simply gets to the end and hangs.

The html code is:

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
   hello
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    hello1
   <title>ACS_CodesTest1</title>
   hello2
    <base href="/" />
   hello3
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
   hello4
    <link href="css/app.css" rel="stylesheet" />
   hello5
   
</head>

<body>
   <h1 style="text-align:center">Welcome to ACS Code Translator</h1>

   hello 7
    <script src="/httpdocs/_framework/blazor.webassembly.js"></script>

   hello8
    <app>Loading webassembly.js...</app>
    hello9
    <div id="blazor-error-ui">
        An unhandled error has occurred.
        <a href="" class="reload">Reload</a>
        <a class="dismiss">🗙</a>
    </div>
   hello10

</body>

</html>

I believe it is failing to load webassembly.js.  I've tried every manner pathname, but not only does nothing work, but no errors are reported.

Thanks in advance for any advice
look at the code, the src=  is starting in httpdocs but the _framework folder starts in wwwroot
So, and I've mentioned, I've tried all manner of pathname, the one reported most recently by Chrome is

"http://acscodes.com/httpdocs/_framework/blazor.webassembly.js"

As near as I can tell, that is a valid full pathname.

httpdocs is the webroot so it can't be in the path after .com

If you changed the start directory to wwwroot, then that will be top evel. 
I was able to cerf to http://acscodes.com/_framework/ so that means your site is starting at wwwroot. Therefore the js file is at http://acscodes.com/_framework/blazor.webassembly.js
The site is sort-of doing everything it needs to do, EXCEPT actually create output.

The output from Chrome Debug is:
BTW, the blazor.webassembly.js:1 is hand typed; ^C for reasons unknown wont copy it.
-----------------------------------------------
Streaming compilation failed. Falling back to blazor.webassembly.js:1
ArrayBuffer instantiation.  TypeError: Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
dotnet.3.2.0.js:1 mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
blazor.webassembly.js:1 
3blazor.webassembly.js:1
blazor.webassembly.js:1 /
dotnet.3.2.0.js:1 GET http://acscodes.com/Codes 404 (Not Found)
_mono_wasm_invoke_js_with_args @ dotnet.3.2.0.js:1
do_icall @ 00755c3a:0x10f8b1
do_icall_wrapper @ 00755c3a:0x50b6a
interp_exec_method @ 00755c3a:0x2588e
interp_runtime_invoke @ 00755c3a:0xf7391
mono_jit_runtime_invoke @ 00755c3a:0xddb3d
do_runtime_invoke @ 00755c3a:0x3ba85
mono_runtime_invoke_checked @ 00755c3a:0x96a2
mono_runtime_try_invoke_array @ 00755c3a:0x66c26
ves_icall_InternalInvoke @ 00755c3a:0xb44ff
ves_icall_InternalInvoke_raw @ 00755c3a:0xb3ffd
do_icall @ 00755c3a:0x10f8b1
do_icall_wrapper @ 00755c3a:0x50b6a
interp_exec_method @ 00755c3a:0x2588e
interp_runtime_invoke @ 00755c3a:0xf7391
mono_jit_runtime_invoke @ 00755c3a:0xddb3d
do_runtime_invoke @ 00755c3a:0x3ba85
mono_runtime_try_invoke @ 00755c3a:0xcfdb
mono_runtime_invoke @ 00755c3a:0x44b39
mono_wasm_invoke_method @ 00755c3a:0xca6a7
Module._mono_wasm_invoke_method @ dotnet.3.2.0.js:1
call_method @ dotnet.3.2.0.js:1
(anonymous) @ dotnet.3.2.0.js:1
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
s @ blazor.webassembly.js:1
e.invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
t.dispatchEvent @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
e.onGlobalEvent @ blazor.webassembly.js:1
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: Response status code does not indicate success: 404 (Not Found).
System.Net.Http.HttpRequestException: Response status code does not indicate success: 404 (Not Found).
  at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode () <0x23ec0a0 + 0x00052> in <filename unknown>:0
  at System.Net.Http.Json.HttpClientJsonExtensions.GetFromJsonAsyncCore[T] (System.Threading.Tasks.Task`1[TResult] taskResponse, System.Text.Json.JsonSerializerOptions options, System.Threading.CancellationToken cancellationToken) <0x1c8ed78 + 0x0012a> in <filename unknown>:0
  at ACS_CodesTest1.Client.Pages.PrintValues.OnInitializedAsync () <0x2363c48 + 0x0012c> in <filename unknown>:0
  at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x1f22500 + 0x00154> in <filename unknown>:0
  at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x223cf08 + 0x000ca> in <filename unknown>:0

----------------------------------------------------------------------------------------------
Since VS seems to scatter components to places that GoDaddys server doesn't like (see my next comment), I've placed a copy of Codes in just about every directory.  So I think it can find the file.  

Any thoughts will be greatly appreciated.

BTW, I think, emphasis on think, that the lines of code causing the problem are:

        selectedcodes = new List<string>();
        var str = Base64Url.Base64.ToString(obj);
        myClass = System.Text.Json.JsonSerializer.Deserialize<MyClass>(str);
        myClass.Codes = await http.GetFromJsonAsync<List<string>>("Codes.txt");  
So VS is scattering components to places where GoDaddy's server can't seem to find them.

The root, if VS has its way will be acscodes.com/httpdocs/wwwroot
Yet the CSS directory is in acscodes.com/httpdocs

Have I set up VS (2019 community) incorrectly, is GoDaddy goofy or set up incorrectly, or is this just the way it is.  I don't mind spending a few hours moving stuff around, but I am concerned about how fragile this will be after updates, etc.

Again, many thinks for all of you guys and your willingness to help
Scott,

The copy where wwwroot was the root, didn't work at all.  So, I restored to a mostly working copy where the root files such as Index.html were in httpdocs (manually moved yesterday), and I reset the root dir.
One last point, I am doing what amounts to s linear or sequential search of the file.  Is my methodology the best way to get there.  IOW, can I do a grep, fopen, open, or other simple command, and would it be less problematic than the Json stuff?  I know less than nothing about web security, but I have been led to believe that security issues preclude the greps and opens.
Another thought:  The "Codes" list is about 300K, and will be unlikely to grow beyond 2M, and probably a lot less.  Should I consider just hard coding an array or list?  I would NEVER do this in the C, C++, VC++ World, but just wondering?

The nice thing about having a text file is that I can update the code list from time to time without updating the SW.
You have to update your start directory by going to Plesk ->Hosting Settings -> Document Root.  



User generated image


User generated image
As I mentioned last, it looks like you already have this set to point to the wwwroot folder.  If you upload a text file called test.txt to that folder, you will be able to cerf to  http://acscodes.com/test.txt 

If you have a file called test.html that you upload to the top level and a folder called css with a file called test.css. Then upload a folder called js with a file called test.js, your code would look like this:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
<script src="/js/test.js"></script>
<link href="/css/test.css" rel="stylesheet" type="text/css" />


  <title>test</title>
</head>
<body>
Hello World
</body>
</html>

Open in new window

Where things may get confusing is your ftp credentials probably allow you to get the root of your hosting which will be above the start directory you created. This means you will have to also adjust how you set up your site upload to start in the proper folder.

Try getting this done first with a simple HTML file like my sample and also have that HTML file access a javascript and the text should be manipulated by css.  By getting this simple test working, you will know that your errors for site set up are corrected and then any other errors are going to be most likely coding and for that I would just start another question.
Yet the CSS directory is in acscodes.com/httpdocs 

The CSS directly needs to be in acscodes.com/httpdocs/wwwroot  as does everything else.


I think what you will need to do is set up your deployment to point to the correct folder.

https://docs.microsoft.com/en-us/visualstudio/deployment/tutorial-import-publish-settings-iis?view=vs-2019

User generated image
ASKER CERTIFIED SOLUTION
Avatar of rickhill11
rickhill11

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I would strongly recommend to go with anyone else BUT GoDaddy if you are a .net dev and want peace of mind. I left them 8 years back and that was the best decision I took. I had a bad experience with A2hosting but after that..(Interserver.net) it has been smooth sailing. Look for .net specialist hosts here:
ASP.NET Hosting | .NET (microsoft.com) 

PS: Avoid smaterasp.net ... bunch of thieves...