0

I'm developing a website using ASP.NET Core MVC and Orchard Core. Right now I need to publish it on an IIS server. It works perfectly fine when using Visual Studio, but when I 'publish it' and then go on the website using the IP or the name, Firefox console tells me that :

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

or the same but instead of 'text', there is 'html'.

I have already went through those questions&answers:

And downloaded an extension called Fix Filed Encoding.

Here is my web.config :

enter image description here

My files on IIS :

enter image description here

My code for the _layout :

enter image description here

My Controller for the default page : enter image description here

My startup.cs page : enter image description here

And the error in firefox console (but in French) :

enter image description here

I observed the network of firefox and had this : enter image description here

Could you help me or give me some hints Thanks in advance !

Crakenar
  • 83
  • 10

2 Answers2

1

So Orchard could not connect to the Databaseand could not recognize his own tables so I had to manually create them and it solved it.

Crakenar
  • 83
  • 10
0

Try to to set the responseEncoding attribute of the globalization element.

<configuration>
  <system.web>
    <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
  </system.web>
</configuration>
samwu
  • 3,857
  • 3
  • 11
  • 25
  • I rebooted the server and it is still the same problem – Crakenar Oct 07 '20 at 09:32
  • Have you tried adding my above code to your web.config file? – samwu Oct 08 '20 at 03:16
  • Try to grant IUSR and IIS_IUSR permission to access the IIS folder and restarted the server again. – samwu Oct 08 '20 at 09:50
  • all my users have at least the read and execute permission but still nothing – Crakenar Oct 09 '20 at 13:35
  • Have you installed .NET Core Hosting Bundle? If not, please install [.NET Core Hosting Bundle](https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle). – samwu Oct 13 '20 at 08:11
  • I did install .Net Core Hosting Bundle – Crakenar Oct 14 '20 at 09:06
  • You can try to use evnet viewer or [failed request tracking](https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis) to view detailed error information – samwu Oct 15 '20 at 07:05
  • Ok so the problem was coming from the database, my user could not be identificate. So I added him some permisisons... but now it seems that the name of my table is not correct ? The name of tables are dbo.trix_XXXXXXX so in my connection string I did { "ConnectionString": "Server=Server;Database=DatabaseName;User Id=sa;Password=XXX", "DatabaseProvider": "SqlConnection", "TablePrefix": "trix_" } – Crakenar Oct 16 '20 at 07:01
  • If it is caused by the connection string, then the project should not work with visual studio. – samwu Oct 16 '20 at 08:24