Multilingual ASP.NET Web Site doesn't work - c#

Here is the link, where author explains how to a build multilingual website
When I run the code, I get such an error mesage "An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode."
Then I found such an workaround in web.config file:
<configuration>
.
.
.
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
</configuration>
Now the website works for me, but is shown only in russian, not in english or greek. I am new to ASP.NET, so don't clearly understand source's LanguageModule class, should I somehow modify it?

There are 2 types of pipeline modes in IIS, integrated and classic. The error you are getting is symptomatic of having your web.config arranged in the classic configuration.
Integrated mode provides more flexibility as both IIS and ASP.NET functionality are executed in the same pipeline, instead of 1 after the other.
It might be possible the the project was configured and hosted on a website configured to run under integrated mode. If this is the case, hosting the Website yourself in an application pool which is set to classic mode, may get you going.
Another thing to check is to ensure things like the HttpModule are registered in the correct manner.

Related

Security Exception in Web.Config On Server [duplicate]

I've encountered an error deploying a site to a server. When trying to load the home page, or access authentication on the new site in IIS, I get the error:
Config Error: This configuration section cannot be used at this path.
This happens when the section is locked at a parent level. Locking is
either by default (overrideModeDefault="Deny"), or set explicitly by a
location tag with overrideMode="Deny" or the legacy
allowOverride="false".
More detail can be found here, in Scenario 7 matches my hex error code.
The solution given on the linked site above is to set Allow for overrideModeDefault in the section mentioned in my error, in the applicationHost.config file. In my case, under Security in system.webServer. But if I look at the applicationHost.config on my local computer, where the site is properly deployed already, that section is set to Deny.
If this solution is correct, how is my local instance running just fine with the same web.config? According to my applicationHost.config, that section should be locked, but it's not. I'd prefer to not change the applicationHost.config file, because there are many other sites running on that server. Is there another solution?
I had the same problem. Don't remember where I found it on the web, but here is what I did:
Click "Start button"
in the search box, enter "Turn windows features on or off"
in the features window, Click: "Internet Information Services"
Click: "World Wide Web Services"
Click: "Application Development Features"
Check (enable) the features. I checked all but CGI.
btw, I'm using Windows 7. Many comments over the years have certified this works all the way up to Windows 10 and Server 2019, as well.
You could also use the IIS Manager to edit those settings.
Care of this Learn IIS article:
Using the Feature Delegation from the root of IIS:
You can then control each of machine-level read/write permissions, which will otherwise give you the overrideMode="Deny" errors.
For Windows Server 2012 and IIS 8, the procedure is similar.
The Web Server (IIS) and Application Server should be installed, and you should also have the optional Web Server (IIS) Support under Application Server.
Browse to “C:\Windows\System32\inetsrv\config” (you will need administrator rights here)
Open applicationHost.config
Note: In IISExpress and Visual Studio 2015 the applicationHost.config is stored in $(solutionDir).vs\config\applicationhost.config
Find the section that showed up in the “config source” part of the error message page. For me this has typically been “modules” or “handlers”
Change the overrideModeDefault attribute to be Allow
So the whole line now looks like:
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
After saving the file, the page loaded up fine in my browser.
Warning:
Editing applicationHost.config on 64-bit Windows
You need to unlock handlers. This can be done using following cmd command:
%windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webServer/handlers
Maybe another info for people that are getting this error on IIS 8, in my case was on Microsoft Server 2012 platform. I had spend couple of hours battling with other errors that bubbled up after executing appcmd. In the end I was able to fix it by removing Web Server Role and installing it again.
1. Open "Turn windows features on or off" by: WinKey+ R => "optionalfeatures" => OK
Enable those features under "Application Development Features"
Tested on Win 10 - But probably will work on other windows versions as well.
I ran these two commands from an elevated command prompt:
%windir%/system32/inetsrv/appcmd unlock config /section:anonymousAuthentication
%windir%/system32/inetsrv/appcmd unlock config /section:windowsAuthentication
As per my answer to this similar issue;
Try unlocking the relevant IIS configuration settings at server level, as follows:
Open IIS Manager
Select the server in the Connections pane
Open Configuration Editor in the main pane
In the Sections drop down, select the section to unlock, e.g. system.webServer > defaultPath
Click Unlock Attribute in the right pane
Repeat for any other settings which you need to unlock
Restart IIS (optional) - Select the server in the Conncetions pane, click Restart in the Actions pane
This Did the trick for me, for IIS 8 Windows server 2012 R2
Go to "Turn on Features"
Then go to all default setting , Next, Next, Next etc..
Then, select as shown below,
Then reset IIS (optional) but do it safer side.
This is an additional solution as its a generic problem everyone have different of problem and thus different solution. Cheers!
The best option is to Change Application Settings from the Custom Site Delegation
Open IIS and from the root select Feature Delegation and then select Application Settings and from the right sidebar select Read/Write
On Windows Server 2012 with IIS 8 I have solved this by enabling ASP.NET 4.5 feature:
and then following ken's answer.
To fix this open up the IIS Express applicationhost.config. This file is stored at C:\Users[your user name]\Documents\IISExpress\config\applicationhost.config
Update for VS2015+: config file location is $(solutionDir).vs\config\applicationhost.config
Look for the following lines
<section name="windowsAuthentication" overrideModeDefault="Deny" />
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<add name="WindowsAuthenticationModule" lockItem="true" />
<add name="AnonymousAuthenticationModule" lockItem="true" />
Change those lines to
<section name="windowsAuthentication" overrideModeDefault="Allow" />
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="WindowsAuthenticationModule" lockItem="false" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
Save it and refresh Asp.net Page.
In our case on IIS 8 we found the error was produced when attempting to view Authentication" for a site, when:
The server Feature Delegation marked as "Authentication - Windows" = "Read Only"
The site had a web.config that explicitly referenced windows authentication; e.g.,
Marking the site Feature Delegation "Authentication - Windows" = "Read/Write", the error went away. It appears that, with the feature marked "Read Only", the web.config is not allowed to reference it at all even to disable it, as this apparently constitutes a write.
Seems that with IIS Express and VS 2015, there's a copy of the applicationHost.config file at $(solutionDir).vs\config\applicationhost.config so you'll need to make changes there. See this link: http://digitaldrummerj.me/iis-express-windows-authentication/
Make sure these lines are changed per below:
<section name="windowsAuthentication" overrideModeDefault="Allow" />
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<add name="WindowsAuthenticationModule" lockItem="false" />
<add name="AnonymousAuthenticationModule" lockItem="false" />
In my case it was that on server was not enabled "HTTP Activation" under .NET Framework Features. So for Windows Server 2012 the solution which worked for me was:
Server Manager -> Add roles and features -> Features -> make sure that under .NET Framework of version you want to use is checked "HTTP Activation"
The Powershell way of enabling the features (Windows Server 2012 +) - trim as needed:
Install-WindowsFeature NET-Framework-Core
Install-WindowsFeature Web-Server -IncludeAllSubFeature
Install-WindowsFeature NET-Framework-Features -IncludeAllSubFeature
Install-WindowsFeature NET-Framework-45-ASPNET -IncludeAllSubFeature
Install-WindowsFeature Application-Server -IncludeAllSubFeature
Install-WindowsFeature MSMQ -IncludeAllSubFeature
Install-WindowsFeature WAS -IncludeAllSubFeature
The error says that the configuration section is locked at the parent level.
So it will not be directly 1 config file which will resolve the issue,
we need to go through the hierarchy of the config files to see the inheritance
Check the below link to go through the File hierarchy and inheritance in IIS
https://msdn.microsoft.com/en-us/library/ms178685.aspx
So you need to check for the app config settings in the below order
ApplicationHost.config in C:windows\system32\inetsrv\config. Change the overrideModeDefault attribute to be Allow.
ApplicationName.config or web.config in the applications directory
Web.config in the root directory.
Web.config in the specific website (My issue was found at this place).
Web.config of the root web (server's configuration)
machine.config of the machine (Root's web.config and machine.config can be found at - systemroot\MicrosoftNET\Framework\versionNumber\CONFIG\Machine.config)
Go carefully through all these configs in the order of 1 to 6 and you should find it.
I noticed one answer that was similar, but in my case I used the IIS Configured Editor to find the section I wanted to "unlock".
Then I copied the path and used it in my automation to unlock it prior to changing the sections I wanted to edit.
. "$($env:windir)\system32\inetsrv\appcmd" unlock config -section:system.webServer/security/authentication/windowsAuthentication
. "$($env:windir)\system32\inetsrv\appcmd" unlock config -section:system.webServer/security/authentication/anonymousAuthentication
I needed to change the SSL settings on a subfolder when i got this nice message. In my case following action helped me out.
Opened C:\Windows\System32\inetsrv\config\applicationHost.config
And changed the value from overrideModeDefault="Deny" to "Allow"
<sectionGroup name="system.webServer">
...
<sectionGroup name="security">
<section name="access" overrideModeDefault="Allow" />
</sectionGroup>
In my case, I got this error because I was operating on the wrong configuration file.
I was doing this:
Configuration config = serverManager.GetWebConfiguration(websiteName);
ConfigurationSection serverRuntimeSection = config.GetSection("system.webServer/serverRuntime");
serverRuntimeSection["alternateHostName"] = hostname;
instead of the correct code:
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection serverRuntimeSection = configApp.GetSection("system.webServer/serverRuntime", websiteName);
serverRuntimeSection["alternateHostName"] = hostname;
in other words, I was trying to operate on the website's web.config instead of the global file C:\Windows\System32\inetsrv\config\applicationHost.config, which has a section (or can have a section) for the website. The setting I was trying to change exists only in the applicationHost.config file.
In my case, it was something else.
When I loaded the solution in a new version of Visual Studio, VS apparently created a new project-specific applicationhost.config file:
MySolutionDir\.vs\config\applicationhost.config
It started using the settings from the new config, instead of my already customized global IIS Express settings.
(\Users\%USER%\Documents\IISExpress\config\applicationhost.config)
In my case this was the setting that needed to be set. Of course it could be something else for you:
<section name="ipSecurity" overrideModeDefault="Allow" />
Received this same issue after installing IIS 7 on Vista Home Premium. To correct error I changed the following values located in the applicationHost.config file located in Windows\system32\inetsrv.
Change all of the following values located in section -->
<div mce_keep="true"><section name="handlers" overrideModeDefault="Deny" /> change this value from "Deny" to "Allow"</div>
<div mce_keep="true"><section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" /> change this value from "Deny" to "Allow"</div>
Can You try this:
Go to application path where you're getting deny error, right click
Properties->Security tab
In that, change the permissions and check the checkbox read and write. Then it will work without any error hopefully.
For Windows Server 2008 and IIS 7, the procedure is similar.
please refer to this:
http://msdn.microsoft.com/en-us/library/vstudio/bb763178(v=vs.100).aspx
in add role service, u will see "Application Development Features"
Check (enable) the features. I checked all.
In my case I was getting this error when attempting to update the authentication settings in IIS also in addition to browsing. I was able to remove this error by removing the authentication setting from the web.config itself. Removing a problematic configuration section may be less invasive and preferable in some cases than changing the server roles and features too much:
Section Removed:
<security>
<authentication>
<windowsAuthentication enabled="true" />
</authentication>
</security>
I had the similar issue, but I used the following powershell script which helped me to achieve above steps in on button click.
#Install IIS
Import-Module ServerManager
Add-WindowsFeature Web-Server, Web-Asp-Net45, Web-Mgmt-Console, Web-Scripting-Tools, NET-WCF-HTTP-Activation45, Web-Windows-Auth
the list of features can be added or removed based on the requirement.
I had an issue where I was putting in the override = "Allow" values (mentioned here already)......but on a x64 bit system.......my 32 notepad++ was phantom saving them. Switching to Notepad (which is a 64bit application on a x64 bit O/S) allowed me to save the settings.
See :
http://dpotter.net/technical/2009/11/editing-applicationhostconfig-on-64-bit-windows/
The relevant text:
One of the problems I’m running down required that I view and possibly edit applicationHost.config. This file is located at %SystemRoot%\System32\inetsrv\config. Seems simple enough. I was able to find it from the command line easily, but when I went to load it in my favorite editor (Notepad++) I got a file not found error. Turns out that the System32 folder is redirected for 32-bit applications to SysWOW64. There appears to be no way to view the System32 folder using a 32-bit app. Go figure.
Fortunately, 64-bit versions of Windows ship with a 64-bit version of Notepad. As much as I dislike it, at least it works.
I had the same issue.
Resolved it by enabling Application Server feature. Restarted iis
after that.
This worked for me
Also in IIS 8 you can solve this problem by changing the server to IIS Express. Goto debug->Properties
In the Web select the server as IIS Express from the dropdown and then rebuild the solution
To make a change at Application Level (Web.Config):
Please remove the Trust Level from the web.config:
Actually I was getting this error when I was trying to host my Website on the Hosting Server where I don't have control on their Server. Removing the above line from my Application web.config solved my issue.

Error when deployed an MVC site in Azure

Recently, I deployed an MVC site builded in VS2013 into Azure. In fact, I have been done 4 deployments so far. The frist tree were deployed OK.
It was untel the last deployment when I'm getting an error saying: That the tag needs to be added in the web.config.
It's weird because while testin git locally I didn't get any error. Until, I deployed it to Azure.
This is the error I'm getting when running it in Azure:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
The changes that I did in this last deployment was to Add some columns using the First Code creation approach, as well as the data migration itself.
Again, locally all works OK. But, once it is in Azure it doesn't.
Any clue, helo, approach?
After spending time googling what's happening I found the solution. However, another problem came.
First of all, I put the tag in the web.config in order to see the errors.
Well, the thing here is that for some reason the Data Migration for the Code First was throwing an exception that was not caught. I added the following line of code in the Startup.Auth.cs file
OnException = context => {}
For more infor, visit: Why is [Owin] throwing a null exception on new project?
In that way, you can bypass the error. Now, if you want to know the exact error, then put:
OnException = (context =>{
throw context.Exception;
})
And you can see what was the error. Which in my case is: The model backing the context has changed since the database was created
I followed the solution for this link: The model backing the <Database> context has changed since the database was created
And it solve the problem in some way.
Since I added two new columns to the AspNetUser table, those new columns are not present in the Azure tables saying the the columns doesn't exists. Even I have those columns added locally. Still figure out how to solve this. I guess I will create another post for this.
Hope this help others

What is the difference between IsDebuggingEnabled and Debugger.IsAttached

Are there any differences between System.Web.HttpContext.Current.IsDebuggingEnabled and System.Diagnostics.Debugger.IsAttached?
If so, what are the exact differences besides the fact that one is only for web applications while the other works in all kind of projects?
HttpContext.IsDebuggingEnabled is about the compilation setting in the web.config. Debugger.IsAttached defines if there is actually an active debugger listening to the information coming from the web server.
See the explanation at DotnetPerls regarding HttpContext.IsDebuggingEnabled:
Debug mode is not the default. ... When you do not set debug="true" in Web.config, the site is compiled in Release mode.
Regarding your question why the first 'one is only for web applications': web applications have the ability to compile at run-time, while all other .NET products are pre-compiled. Because of this, you can define in the web.config if the build is done in Debug or Release mode. This is a ASP.NET only option, so the property is only available there.
As answer to your second question, why the first option is only for ASP.NET: There is also a way for a Windows application to check it's build status: by checking the DebuggableAttribute as explained in How to check if an assembly was built using Debug or Release configuration?.
IsDebuggingEnabled refers to "debug mode" which does not necessarily mean a debugger is actually attached. You can set ASP.NET websites into debug mode by setting <compilation debug="true"> in your web.config file.
When a website is in debug mode, JIT optimizations are not applied to code contained within your view files (.aspx, .cshtml, etc) as well as any runtime-compiled code-behind files or the App_Code directory. There are also other effects.

unable to automatically debug wcf service [duplicate]

I've got a Visual Studio 2008 solution with a WCF service, and a client.
When I run my client, and call a method from my service I get a message saying "Unable to automatically debug 'Home.Service'. The remote procedure could not be debugged. This usually indicates that debugging has not been enabled on the server."
I've googled around, and have tried the following.
<system.web>
<compilation debug="true" />
</system.web>
has been added in app.config on both the client and the server.
I have also made sure that the project is being compiled in Debug mode.
What else could be causing this message?
Edit: Added more info based on feedback questions
It is using wsHttpBinding
I have set
<serviceDebug includeExceptionDetailInFaults="true"/>
I am using
var service = new HomeReference.HomeServiceClient();
service.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
Unfortunately the error shows up the first time I call a method on my Service. I can dismiss the messagebox, and the application continues working. Any Exceptions thrown on the server at not propagated back to the client though (I assume it should?)
I was fighting with this exact same error for over an hour and low and behold I restarted VS2008 and it magically fixed itself. Give it a try as it might save you some time.
In my case the problem turned out to be a mismatch between security settings on client and server. I was using a custom binding like this:
<customBinding>
<binding name="AuthorisedBinaryHttpsBinding" receiveTimeout="00:03:00" sendTimeout="00:03:00">
<!-- this next element caused the problem: -->
<security authenticationMode="UserNameOverTransport">
</security>
<binaryMessageEncoding>
<readerQuotas maxDepth="100" maxStringContentLength="1000000"
maxArrayLength="655360000" />
</binaryMessageEncoding>
<httpsTransport />
</binding>
</customBinding>
When I removed the security element that I've highlighted above the problem with the "Unable to automatically debug" message went away.
To solve the problem I first turned on WCF tracing. This showed me that WCF was throwing a MessageSecurityException:
Security processor was unable to find
a security header in the message. This
might be because the message is an
unsecured fault or because there is a
binding mismatch between the
communicating parties. This can
occur if the service is configured for
security and the client is not using
security.
That pointed me to look at the Binding settings on the client side. It turned out that I hadn't added the required security element to my custom binding there. Since I was doing this through code, I needed the following (note the 3rd line):
var binding = new CustomBinding(
binaryEncoding,
SecurityBindingElement.CreateUserNameOverTransportBindingElement(),
new HttpsTransportBindingElement { MaxReceivedMessageSize = MaxMessageSize, });
As to why Visual Studio was showing that error, I've no idea - looks to me to be a bug.
Automatically attaching to a service has the following limitations:
The service must be part of the Visual Studio solution you are debugging.
The service must be hosted. It may be part of a Web Site Project (File System and HTTP), Web Application Project (File System and HTTP), or WCF Service Library project. WCF Service Library projects can be either Service Libraries or Workflow Service Libraries.
The service must be invoked from a WCF client.
Debugging must be enabled with the following code in the app.config or Web.config file:
<system.web>
<compilation debug="true" />
</system.web>
See Limitations on WCF Debugging
In addition, if both projects (client and service) are in the same solution but will run in different processes (for example if you are using your local IIS Server for development and are running your web application on a different application pool than the service it consumes), you may need to enable "Multiple startup projects" for the solution (on Solution Properties -> Startup Project) so that the debugger can attach to both.
To avoid the service browser window to show up every time you debug, you may set the "Start Action" (on service project properties) to "Don't open a page. Wait for request from external application."
This is from personal experience and may help others.
The other reason you might see this error (and I believe is the case for me) is if you're running in 64bit Windows. Apparently Visual Studio doesn't have any x64 debugger support.
You can work around this by changing the Platform Target for the consuming application:
Project Properties -> Build -> Change "Platform Target" to "x86".
Unfortunately this won't work for me as I'm trying to run in the Windows Azure Development AppFabric which seems to require everything to run in 64bit mode!
I also got the same problem. I changed in both client & service config files like
Compilation debug is set to true.
This worked for me.
Have you tried
<serviceBehaviors>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
For debugging purposes?
Edit : nevermind, I think I misunderstood the question
I've had a similar problem and it turns out to have been due to Windows Authentication not being enabled on the IIS site/virtual directory.
Have you tried setting the authentication mode to Integrated instead of Anonymous?
http://msdn.microsoft.com/en-us/library/x8a5axew(VS.80).aspx
In your web service web.config ensure that compilation debug is set to true.
That should fix your problem!
In my case the problem turned out to be something completely different. I had changed the name of an operation on the webservice and forgot to update the client. For some reason this resulted in the "Unable to automatically debug ..." error.
It can also be that the same port number is used in IISExpress and IIS. If you are developing a WCF application in Visual Studio and IISExpress and then install the same application on your local IIS make sure not to use the same port number in IIS and IISExpress. Using the same port number will lead to this error message.
I had the same issue in Visual Studio 2017. After deleting the hidden .vs folder in the root of the solution folder, I was able to debug again.
Add this line of code after you create your service reference in your client.
MyWCFService.IService _proxy = new MyWCFService.IService();
_proxy.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;

Having trouble deploying ASP MVC app to normal shared hosting provider

I bought the Windows Developer hosting package from fasthosts.co.uk, which I believe is a bog standard shared hosting package. It has ASP.NET 3.5 and, according to their support, also has SP1 installed.
I have developed my web app using ASP MVC 2 preview 1 (which by the way is awesome and I'm looking forward to getting stuck into preview 2) and it works fine on my dev machine, on which I have preview 2 installed via the installer package.
As the server doesn't have MVC installed, I followed
Phil Haacks bin deployment method which doesn't seam to have worked as the following happens...
When I deploy it and copy the files over to the server I get a plain useless "Server Error 500 - Internal server error". So I modified my web config so that customErrors mode="Off" which made no difference so I figured something is happening that is stopping it from even getting to the customErrors bit.
I then proceeded to take out bits of the web config until it gave me a decent error message. I found that it would only give me an error message if the following bits were taken out the config -
The entire configSections sectionThe entire httpHandlers sectionThe entire system.codedom sectionThe handlers and defaultDocument sections of the system.webServer section
I'm using the standard web config that MVC generates with no changes except my own connection string - which I took out for this testing.
Now that I got it to give me an error message, I get the "Could not load file or assembly System.Web.Mvc..." message and I'm stuck! - any suggestions?
Edit:
I bought a new hosting package with someone else and it all worked fine! I was certain it was Fasthosts fault when I deployed an empty MVC app, thanks to Phils suggestion, and then an empty normal web forms app - and they both gave the same errors.
I'm currently in the process of trying to convince them it's their fault, but they keep reassuring me that the problem is with my web config. Tried cancelling my hosting with them but I'm apparently in a 12 month contract even though I opted to pay monthly - oh well.
I guess don't go with Fasthosts would be the one thing to take away from this.
It sounds like it's possible you're not deploying to a webroot. Is that the case? Try deploying an empty MVC project.
I know this is way out of date but I found this Q&A when trying to set up a MVC 5 site on Fasthosts shared hosting platform. The way I got it to work in the end was to add runAllManagedModulesForAllRequests="true" to my web.config like:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
And it all works great!
Update it turns out that this is a bit like cracking a nut with a sledgehammer and can have performance implications. Colin Farr correctly points out that this can be solved more elegantly by modifying your modules section of your web.config to include:
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
<!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. -->
</modules>
The error happens because fast host do not allow system.webserver part of the configuration part to interact with the webserver (Very Annoying). I have bin deployed an MVC website to a fasthost account and it partially works... you can view the index page but routing does not work. To get rid of the errors simply comment out the system.webserver section. I have been unable to get the routing to work using .aspx or .mvc extensions :(
I got my MVC site working as follows:
I added the aspx extension to my default routing map:
routes.MapRoute(
"Default", // Route name
"{controller}.aspx/{action}/{id}", // URL with parameters
new { controller = "Front", action = "Default", id = UrlParameter.Optional }
);
routes.MapRoute(
"Root",
"",
new { controller = "Front", action = "Default", id = "" }
);
I don't think the Root one actually works because I got a 403, 'No directory listing' error, so I added a default.aspx page to the site which just does a redirect in OnInit to "~/Front.aspx/Default" (note that my default controller is renamed to Front instead of Home).
I changed the three Mvc dlls to be Copy Local so that they were deployed to my site's bin directory.
I used HtmlAction for all my page links so that they automatically got the aspx extension.
I noticed that the site was slower on initial load than using webforms but apart from that everything seems to be okay.
Double check your Global.asax and code-behind ... I think this kind of error happens when the application can't even start (hence you have no other error besides 500).
Have you tried putting in a simple, stand alone ASPX page with no code-behind or anything? If so, do you get the same error? If so, I think ASP.NET 3.5 is not configured for your virtual directory, properly, and you'd have to ask tech support to reinstall/repair or set the version in the ASP.NET tab of the IIS virtual directory properties.
You need the ASP.Net MVC 2 dll on the server. In your project, select the dll under properties, change "Copy Local" to true.

Categories