ServiceStack View 403 (Forbidden) - razor

I have setup Service Stack web project with a couple of views. I can access the /Default.cshtml view without any problems but when I try to access anything in the /Views/ folder I get the below error:
Forbidden
Request.HttpMethod: GET
Request.PathInfo: /Views/MyView.cshtml
Request.QueryString:
Request.RawUrl: /Views/MyView.cshtml
I have looked at the answers here and here as well as many others but I can't seem to figure this out.
Here is my view:
#{
ViewBag.Title = "Fake View";
}
<div>
<div>Hello!</div>
</div>
And my Web.Config:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<sectionGroup name="jsEngineSwitcher">
<section name="core" type="JavaScriptEngineSwitcher.Core.Configuration.CoreConfiguration, JavaScriptEngineSwitcher.Core" />
<section name="msie" type="JavaScriptEngineSwitcher.Msie.Configuration.MsieConfiguration, JavaScriptEngineSwitcher.Msie" />
<section name="v8" type="JavaScriptEngineSwitcher.V8.Configuration.V8Configuration, JavaScriptEngineSwitcher.V8" />
</sectionGroup>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation targetFramework="4.5" debug="true">
<buildProviders>
<add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
</buildProviders>
</compilation>
<httpRuntime targetFramework="4.5" />
<httpHandlers>
<add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
<pages controlRenderingCompatibilityVersion="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<urlCompression doStaticCompression="true" doDynamicCompression="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
<security>
<requestFiltering>
<hiddenSegments>
<add segment="ClearScript.V8" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
<jsEngineSwitcher xmlns="http://tempuri.org/JavaScriptEngineSwitcher.Configuration.xsd">
<core>
<engines>
<add name="MsieJsEngine" type="JavaScriptEngineSwitcher.Msie.MsieJsEngine, JavaScriptEngineSwitcher.Msie" />
<add name="V8JsEngine" type="JavaScriptEngineSwitcher.V8.V8JsEngine, JavaScriptEngineSwitcher.V8" />
</engines>
</core>
</jsEngineSwitcher>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="webPages:Enabled" value="false" />
</appSettings>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc" />
<pages pageBaseType="ServiceStack.Razor.ViewPage">
<namespaces>
<add namespace="System" />
<add namespace="ServiceStack" />
<add namespace="ServiceStack.Html" />
<add namespace="ServiceStack.Razor" />
<add namespace="ServiceStack.Text" />
<add namespace="ServiceStack.OrmLite" />
<add namespace="ConnectDevelop.Configuration.Web" />
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>
I've also added ?debug=requestinfo to the end of the request but I can't see any obvious errors in the output.
Any help would be appreciated.

See the difference between Views vs Content Pages, i.e. the /Views folder is a special folder for view pages that are only executed with the result of a Service (i.e. similar to ASP.NET MVC Controllers + Views).
Essentially Razor pages in /Views can't be called directly, where as razor pages outside of /Views can only be called directly.

Related

Error with web.config and CDATA

I am getting the following error when I run my code:
System.Configuration.ConfigurationErrorsException: 'The configuration section cannot contain a CDATA or text element'
The application builds just fine but when I select the link to go to the view "about" in the application it throws the error above.
This is the line that it highlights in the code:
string conn = ConfigurationManager.ConnectionStrings["CountryConnectionString"].ConnectionString;
and this is the connection string in the web.config file:
<add name="CountryConnectionString" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=TestData" providerName="System.Data.SqlClient" /> 
If more is needed let me know and I can post whatever you need
Here is the entire web config file
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
</system.webServer>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<connectionStrings>
<add name="CountryConnectionString" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=TestData" providerName="System.Data.SqlClient" /> 
</connectionStrings>
</configuration>
Short solution: remove al whitespace between tags.
If I copy your config contains a character that renders as whitespace but actually isn't. To the config parser anything other than spaces and tabs, is text. Text is not allowed in config files.
// the spacing character
Encoding.UTF8.GetBytes(new[] { ' ' })[0] // yields 194
Encoding.UTF8.GetBytes(new[] { ' ' })[1] // yields 160
// the actual space
Encoding.UTF8.GetBytes(new[] { ' ' })[0] // yields 32
Try to change the config to:
<connectionStrings><add name="CountryConnectionString" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=TestData" providerName="System.Data.SqlClient" /></connectionStrings>
Before re-adding spaces and enters
<connectionStrings>
<add name="CountryConnectionString" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=TestData" providerName="System.Data.SqlClient" />
</connectionStrings>

NServiceBus Unhandled exception on my Program class when I start debugging

Non Production Issue:
After migrating from NServiceBus 3 to 4 and from VS2010 to 2012 I get this unhandled exception on my Program class when I start debugging. This exception was originated in NServiceBus.Host library.
System.Configuration.ConfigurationErrorsException was unhandled
HResult=-2146232062
Message=Unable to set the value for key: ScaleOut.UseSingleBrokerQueue. The settings has been locked for modifications. Please move any configuration code earlier in the configuration pipeline
Source=NServiceBus.Core
BareMessage=Unable to set the value for key: ScaleOut.UseSingleBrokerQueue. The settings has been locked for modifications. Please move any configuration code earlier in the configuration pipeline
Line=0
StackTrace:
at NServiceBus.Settings.SettingsHolder.EnsureWriteEnabled(String key) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 174
at NServiceBus.Settings.SettingsHolder.Set(String key, Object value) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\SettingsHolder.cs:line 57
at NServiceBus.Settings.ScaleOutSettings.UseSingleBrokerQueue() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Settings\ScaleOutSettings.cs:line 18
at NServiceBus.Hosting.Windows.Roles.Handlers.ServerRoleHandler.<ConfigureRole>b__0(ScaleOutSettings s) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Roles\Handlers\ServerRoleHandler.cs:line 17
at NServiceBus.Configure.ScaleOut(Action`1 customScaleOutSettings) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Configure.cs:line 185
at NServiceBus.Hosting.Windows.Roles.Handlers.ServerRoleHandler.ConfigureRole(IConfigureThisEndpoint specifier) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Roles\Handlers\ServerRoleHandler.cs:line 19
at NServiceBus.Hosting.Roles.RoleManager.ConfigureBusForEndpoint(IConfigureThisEndpoint specifier) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\Roles\RoleManager.cs:line 67
at NServiceBus.Hosting.GenericHost.PerformConfiguration() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\GenericHost.cs:line 189
at NServiceBus.Hosting.GenericHost.Start() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Core\Hosting\GenericHost.cs:line 86
at NServiceBus.Hosting.Windows.WindowsHost.Start() in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\WindowsHost.cs:line 55
at NServiceBus.Hosting.Windows.Program.<>c__DisplayClasse.<Main>b__6(WindowsHost service) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Program.cs:line 80
at Topshelf.Internal.ControllerDelegates`1.StartActionObject(Object obj) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ControllerDelegates.cs:line 18
at Topshelf.Internal.IsolatedServiceControllerWrapper`1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\IsolatedServiceControllerWrapper.cs:line 65
at Topshelf.Internal.ServiceController`1.<.cctor>b__1(ServiceController`1 sc) in c:\Projects\TopShelfForNSB\src\Topshelf\Internal\ServiceController.cs:line 35
at Magnum.StateMachine.LambdaAction`1.Execute(T instance, Event event, Object parameter) in :line 0
at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter) in :line 0 at NServiceBus.Hosting.Windows.Program.Main(String[] args) in y:\BuildAgent\work\31f8c64a6e8a2d7c\src\NServiceBus.Hosting.Windows\Program.cs:line 151
InnerException:
Stacktrace: NServiceBus.Host.exe!NServiceBus.Hosting.Windows.Program.Main(string[] args) Line 149 C#
app.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="TransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="SecondLevelRetriesConfig" type="NServiceBus.Config.SecondLevelRetriesConfig, NServiceBus.Core" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="GripHandlers.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core" />
<section name="AuditConfig" type="NServiceBus.Config.AuditConfig, NServiceBus.Core" />
</configSections>
<appSettings>
<add key="DB" value="Data Source=Miguel;persist security info=True;user id=Miguel;password=Miguel" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="LogDir" value="c:\Grip\OutputMessages" />
</appSettings>
<SecondLevelRetriesConfig Enabled="false" TimeIncrease="00:00:10" NumberOfRetries="3" />
<TransportConfig NumberOfWorkerThreads="4" MaxRetries="5" />
<UnicastBusConfig TimeoutManagerAddress="" DistributorControlAddress="" DistributorDataAddress="">
<MessageEndpointMappings>
<add Messages="Grip.Gateway.Events.Grip.ProcessedWithQualityIssuesEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalPlacementDeletedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalPlacementModifiedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalTradeAddedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalTradeDeletedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.External.ExternalTradeModifiedEvent, Grip.Gateway.Events.External" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.GripGatewayNotifiedEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.IntegrationExceptionEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.AddAGripPlacementProcessedByService, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementAddedToGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementModifiedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementDeletedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.TradeAddedToGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.TradeModifiedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.TradeDeletedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementLinkedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
<add Messages="Grip.Gateway.Events.Grip.PlacementUnLinkedInGripEvent, Grip.Gateway.Events.Grip" Endpoint="Worker" />
</MessageEndpointMappings>
</UnicastBusConfig>
<applicationSettings>
<GripHandlers.Properties.Settings>
<setting name="MonitorPerformance" serializeAs="String">
<value>False</value>
</setting>
<setting name="EndpointSLA" serializeAs="String">
<value>10</value>
</setting>
</GripHandlers.Properties.Settings>
</applicationSettings>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="ERROR" />
<log4net debug="false">
<appender name="file" type="log4net.Appender.RollingFileAppender">
<file>c:\Grip\Logs\GripHandlers.log</file>
<maximumFileSize value="5MB" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<appender name="console" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c [%x] <%X{auth}> - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="file" />
<appender-ref ref="console" />
</root>
</log4net>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="StructureMap" publicKeyToken="e60ad81abae3c223" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.4.0" newVersion="2.6.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NServiceBus.Core" publicKeyToken="9fc386479f8a226c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NServiceBus" publicKeyToken="9fc386479f8a226c" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.6.0.0" newVersion="4.6.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<AuditConfig QueueName="audit" />
</configuration>
EndpointConfig.cs
using System;
using System.Diagnostics.CodeAnalysis;
using System.Transactions;
using GripHandlers.Properties;
using NServiceBus;
using StructureMap;
namespace GripHandlers
{
[ExcludeFromCodeCoverage]
public class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization, AsA_Server
{
public void Init()
{
SetLoggingLibrary.Log4Net(() => log4net.Config.XmlConfigurator.Configure());
var container = new Container(new GripHandlersRegistry());
Configure.Transactions
.Advanced(settings => settings.IsolationLevel(IsolationLevel.RepeatableRead))
.Enable();
//Tried this but no luck :(
//Configure.ScaleOut(s => s.UseUniqueBrokerQueuePerMachine());
Configure.With(AllAssemblies.Except("Oracle.DataAccess.dll"))
.StructureMapBuilder(container)
.UnicastBus()
.UseTransport<Msmq>()
.SetEndpointSLA(new TimeSpan(0, 0, Settings.Default.EndpointSLA))
.EnablePerformanceCounters()
.CreateBus()
.Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());
}
}
}
Yes I’m using NServiceBus.Host process.
Already had found and tried this doc without success: NService Bus : "Unable to set the value for key: ScaleOut.UseSingleBrokerQueue."
Helpful information to include
Product name: NServiceBus
Version: 4.6.1
From the link you posted: did you try removing CreateBus() and Start()? I don't think those are needed anymore when you use ASA_Server. – Phil Sandler 2 days ago
Thanks to Phil.

HttpContext.Current.IsDebuggingEnabled always true

Why my site is running debug mode?
HttpContext.Current.IsDebuggingEnabled is always true!
Bundles not working!
Although #if DEBUG is false so DEBUG is not defined!
Precompilation is enabled on my appharbor app.
In my Web.Release.config I remove debug:
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
Online Transformation Tester give me this result tested with my Web.config and Web.Release.config:
<?xml version="1.0"?>
<!--
Para obtener más información sobre cómo configurar la aplicación de ASP.NET, visite
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=9831a429-a608-4055-8bb9-a2bb016f79a3.sqlserver.sequelizer.com;Initial Catalog=db9831a429a60840558bb9a2bb016f79a3;user id=wgomqcwgmezvqifh;password=JqgJKAdNmPvR6ZSwsVJYZtP7VYE2pZaTmn6Mntozm4r8TjtMAEFZRwzqHhVT4kxu;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" />
<add name="StorageConnectionString" connectionString="UseDevelopmentStorage=true" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="TwitterKey" value="{TwitterKey}" />
<add key="TwitterSecret" value="{TwitterSecret}" />
<add key="FacebookKey" value="{FacebookKey}" />
<add key="FacebookSecret" value="{FacebookSecret}" />
<add key="MicrosoftKey" value="{MicrosoftKey}" />
<add key="MicrosoftSecret" value="{MicrosoftSecret}" />
<add key="AnalyticsCode" value="{AnalyticsCode}" />
<add key="AnalyticsDomain" value="{AnalyticsDomain}" />
<add key="CrawlerServiceApiId" value="{CrawlerServiceApiId}" />
<add key="CrawlerServiceApplication" value="{CrawlerServiceApplication}" />
<add key="CrawlerServiceEndPoint" value="{CrawlerServiceEndPoint}" />
<add key="EmailServer" value="{EmailServer}" />
<add key="EmailUser" value="{EmailUser}" />
<add key="EmailPassword" value="{EmailPassword}" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule" />
</modules>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31BF3856AD364E35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.6.0.0" newVersion="5.6.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
When debugging from Visual Studio, your web.config transforms are NOT applied. This means your default Web.config likely has the line <compilation debug="true" targetFramework="4.6.1"/> , emphasizing the debug="true".
Removing the debug="true" attribute from the compilation element in your base Web.config file will make HttpContext.Current.IsDebuggingEnabled equal to false.
Some other options: If you are trying to see if the request is from your local machine, you can check for Request.IsLocal instead of HttpContext.Current.IsDebuggingEnabled, or to check for an active debugger Debugger.IsAttached
I'm have the same issue.
Temporarily, I'm using this workaround found in http://support.appharbor.com/kb/getting-started/managing-environments.
<add key="Environment" value="Debug"/>
Appharbor will replace the value="Debug" to the environment that was set in AppHarbor https://appharbor.com/applications/{appname}/edit
.
Instead of checking for HttpContext.IsDebugingEnabled, I'll check for
var isInDebugMode = ConfigurationManager.AppSettings["Environment"].Equals("Debug", StringComparison.InvariantCultureIgnoreCase));

Deploying - MySQL with Entity Frame Work

I have an MVC4 app which is ready to be deployed. The app is database first entity framework with MySQL not MSSQL. As far as dubugging goes, I have no errors with the connection string below but when I go to deploy the app to Amazon Elastic Beanstalk it brings me to the login screen but when i go to login, it throws an error:
Failed to find or load the registered .Net Framework Data Provider.
I'm not sure what the correct way to have a web.config configured for MySQL Deployments assuming that the web config is the problem to begin with. Any ideas on what I'm missing?
Web.Config:
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="MyFinDevEntities" connectionString="metadata=res://*/MyFinAdminModel.csdl|res://*/MyFinAdminModel.ssdl|res://*/MyFinAdminModel.msl;provider=MySql.Data.MySqlClient;provider connection string="user id=xxxxx;password=xxxxx;server=xxxxx.us-west-2.rds.amazonaws.com;database=xxxxDev"" providerName="System.Data.EntityClient" /> <!-- providerName="MySql.Data.MySqlClient"-->
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<customErrors mode="Off"></customErrors>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
If you are bin-deploying/xcopying MySQL's Connector/Net provider, you may need to add the following fragment to your web.config
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description="Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
</DbProviderFactories>
</system.data>

Error in visual studio express for web 2012

i'm new to this and i get an error and don't know how to slove.
I create a new mvc4 project(c#),empty template.
then i add a controller(empty mvc template), and i put his code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Testing.Controllers
{
public class Testing2Controller : Controller
{
//
//GET: /Testing2/
public string Index()
{
return "01111000100011";
}
}
}
and i get this:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
my web.config file is this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>
Thank you very much, i have no idea of what to do
Your controller method needs to return an ActionResult. you need to do something like this:
public ActionResult Index()
{
return Content("01111000100011");
}
Update
I just noticed that the error mentions the URL /. To get to the controller action in your question you'll have to go to /Testing2.