Can't get Visual Studio 2013 browser link working with static html - angularjs

I've been having trouble getting Visual Studio's browser link functionality to work consistently. The projects I've tried it in have all used Service Stack and Angular.
I've added the handler in the system.webservice section but still nothing.
<handlers>
<add name="Browser Link for HTML" path="*.html" verb="*" type="System.Web.StaticFileHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="File" preCondition="integratedMode" />
</handlers>

I found the answer! It turns out that something with the tag in the web.config is a bit different.
I had setup service stack first under the location /api. I didn't notice this right away when adding the browser link handler which meant I added it under the api location.
I then tried to add it to it's own system.webServer section but that gave me issues with service stack. I found that even an empty system.webServer section seemed to wipe out the service stack http handler. (see the 2nd system.webServer section)
INCORRECT
<!-- Required for IIS 7.0 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
</location>
<system.webServer>
</system.webServer>
What did work was to move the service stack http handler out of the location tag and specify the path for it separately
CORRECT
<location path="api">
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
</location>
<!-- Required for IIS 7.0 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="api" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
<add name="Browser Link for HTML" path="*.html" verb="*" type="System.Web.StaticFileHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" resourceType="File" preCondition="integratedMode" />
</handlers>
</system.webServer>

Related

HTTP 404: The /Media directory is not serving images

I cloned a client's Orchard CMS. The repository that I cloned did not contain the Media folder (this is good). So, a next step was to restore the Media/Default directory from a .zip backup. Now that I've restored that, browsing the to site gives a 404 error for all resources in the Media folder. Why?
Quick Fix
The /Media folder is missing its required Web.config file. Add it.
Media/Web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
Details
Out-of-the-box, Orchard's Media folder contains a Web.config file. Since source control excluded the Media folder it also did not have its Web.config. In IIS 7+ Integrated Mode, the following config is required for serving static files, because the root Orchard.Web/Web.config file <clear/>s all handlers.
<add name="StaticFile"
path="*"
verb="*"
modules="StaticFileModule"
preCondition="integratedMode"
resourceType="File"
requireAccess="Read" />

Post to mini-profiler-results gives a 404 but only on live deployed site

I'm having some problems getting the POST results from MiniProfiler after the page has loaded.
I've tried a GET, and that works. But the POST returns a 404 error as if it were looking for a static file.
Any help or hints as to what I can try next would be much appreciated.
Here's what I've looked at so far:
It's Not My Routes
The GET/POST issue would lead me to suspect a problem with my routes - except...
This problem only occurs on the live server. Locally, the routing runs fine.
It Might be: runAllManagedModulesForAllRequest?
Most things I've read suggest setting this to true. However my problem seems to contradict this.
The problem occurs when runAllManagedModulesForAllRequest="true" set to true, and is fixed when set to false. I would like to keep it set to true because I'm not knowlegable enough to change that from the default setting.
Adding a Handler Didn't Help
Other resources, like this one (at the bottom of MP's home page), suggest adding this line to system.webServer.handlers in web.config.
As I understand it, this should allow MP to run even if runAllManagedModulesForAllRequests is set to false. For me, it has had no effect either way.
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
But Could The handlers Section in Web.Config be Related?
I have no particular reason to think it is...
I just don't fully understand what it's doing and wonder if this could account for the difference between local and deployed versions.
<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" />
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="" />
</handlers>

SqlMembershipProvider not compatible with this version

I generated a script for my aspnet Database, now when I try to use the database it gives an error
The 'System.Web.Security.SqlMembershipProvider' requires a
database schema compatible with schema version '1'. However,
the current database schema is not compatible with this version. You
may need to either install a compatible schema with aspnet_regsql.exe
(available in the framework installation directory), or upgrade the
provider to a newer version.
What options do I really have to solve this problem?
Do I need to run aspnet_regsql.exe or is there a way to get around this error besides having to go with this option as the error suggests?
My web.config file looks like this:
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
<membership defaultProvider="SqlProvider">
<providers>
<clear/>
<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="CPMS_DB"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="false"
maxInvalidPasswordAttempts="3"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="3"
applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="ApplicationServices"
applicationName="/"/>
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices"
applicationName="/"
name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/"
name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
I would use the aspnet_regsql.exe to create a new/blank database.
Then you could use this:
http://granadacoder.wordpress.com/2007/11/29/membershipprovider-helper-to-transfer-data/
It will "create tsql code" so you can move all your data into your blank database.
I had similar error, 'simple' solutions like closing the project and re-opening, rebuilding, resolves the error. that's if you're sure you did everything correctly

ServiceStack update caused all services to 404

We've been running servicestack for quite a while now and have just gotten around to updateing OrmLite and the core ServiceStack libraries with it.
Everything was working great before the update but now the metapage and all services return a 404 - not found page.
Looking at the web.config nothing has changed.
Why is it now returning 404 pages and how do I fix it?
Web.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.5.4.0" newVersion="6.5.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
</configuration>
AppHost is located on gist here: https://gist.github.com/JohnACarruthers/5366462
Routes 404ing seem to be all of them, metadata and REST urls specifically.
ServiceStack is hosted on mono's fastcgi server through apache, the config of neither has changed.
We're on the current nuget package now (3.9.43.0) and were on 3.9.25.0.
UPDATE:
Mysql.Data was throwing an OverflowException when executing raw SQL. Rolled back to and older version and things seem to work again. The bugged version of Mysql.Data was 6.6.4.0.

URL Routing is not working in asp.net4 when published

I used ` RouteTable.Routes.MapPageRoute for my pages in website
same as
RouteTable.Routes.MapPageRoute(1,
"~/LNG/WebSites/Vission/vissions.aspx","vission");
RouteTable.Routes.MapPageRoute(2,
"~/LNG/WebSites/Loss/LossCiculars.aspx","Loss Circular");
`....
but this worked for some page .
i have an error for other page http 404
in web.config i added this line
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" /> </modules>
</system.webServer>
Note : this code worked correctly when i have run project in v.s.
help me plz if you can
thanks

Resources