0

After developping my Website using ASP.NET, C# and the MVC pattern, i'm now to the point of deploying my site to a 'real' server (not IIS express from visual studio anymore).

So, i tried to use Web deploy, configured everything and it seem to have been properly done because i now see all my files from the server side.

But sadly, when i try to access the website, i run into error 403 (from both the client and the server), the server gives me a little more information :

"Error 403.14 - Forbidden - The server isn't configured to show the files of this directory"

If i try to use the url as i did with Visual Studio (like, url/Views/Home/) and it returns this :

Error 500.19 28: <system.webServer> 29: <handlers> 30: <remove name="BlockViewHandler"/>

Here's the web.config files concerned : (a bit)

  <system.webServer>
<handlers>
  <remove name="BlockViewHandler"/>
  <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>

I don't see where's the problem, as this website was running fine from Visual Studio.

The deploy is done in release mode.

EDIT: I enabled directory browsing, and it returns the same error 500 when i get in the 'Views' folder

Orsu
  • 405
  • 6
  • 19
  • check when publishing u selected Release Mode instead of debug mode as Deploy Mode – Mir Gulam Sarwar Feb 16 '16 at 09:10
  • "The server isn't configured to show the files of this directory" means IIS couldn't find a Default Document (e.g. `index.html` or `Default.aspx`). If you're using ASP.NET's URL routing (you probably are if you're using ASP.NET MVC) then you need to ensure your application's root directory is defined as an Application Scope in IIS Manager (if you don't have access to IIS Manager, contact your webhost). A website can have multiple Application Scopes defined as a way of allowing multiple applications (with their own `bin` folder and top-level `web.config` files) to coexist side-by-side. – Dai Feb 16 '16 at 09:25
  • i've tried to add 'Index.cshtml' as default document (even if it seems silly) but it stills returns me that error 500 – Orsu Feb 16 '16 at 09:31

2 Answers2

0

There can be many reason for this issue, I also faced this problem and it was due to connection string, I was using Integrated Security=true

1) To fix the issue I added Sql User in my connection string and it solved my issue

e.g. your connection string should look like

User ID=testuser;Password=testpassword;Initial Catalog=testdb;Data Source=testserver

2) Another reason could be that your MVC project has a different .Net framework from Application pool in which you hosted your site

Naveed Yousaf
  • 436
  • 4
  • 14
0

I solved my own problem by removing "development" features from the server, reboot, add them again and it was fine.

Orsu
  • 405
  • 6
  • 19