Browser Link not working in Visual Studio 2015 Community - asp.net

I just started using Visual Studio and tried to duplicate a tutorial by Bob Tabor. Trying to display a HTML file using Browser connect.
Here's what I'm doing:
New project
Web ASP.NET Web Application
Empty
Add new item --> HTML page
Add 'test" to to title and body
Try to view in browser - get http://localhost:51962/HtmlPage1.html
with no response
Browser dashboard says no connections
Added to web.config:
<system.webServer>
<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>
</system.webServer>
But nothing seems to work. Could someone provide the proper steps?
I think it might be a server issue. localhost is a connection to a MySQL database called final project. BlueWater is the name of my computer. I'm able to connect to the Mysql database. I made sure I was using 4.5.2 and also that our web.config files match. Thanks again for your help. Here's a screenshot of Server Explorer:

I tried to replicate your issue and the results were as desired. Let me add screenshots so that you can follow through. I am using Visual Studio 2015 Community on Windows 10 with 4.5.2 .NET Framework.
Starting a new project
Choosing the type of project
Adding an HTML page
Adding test to HTML page
(Clicked on Google Chrome to run the project)
Running the project
My Web.config looks like this:
<?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>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.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.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
</compilers>
</system.codedom>
</configuration>
Can you replicate these steps?
EDIT: DCR and I weren't able to get IISExpress to show web page. So, we decided to troubleshoot multiple areas. Here's what worked.
IIS Webserver was running, so we decided to leverage that (if you don't have IIS you can install it by going to Start > Control Panel > Programs > Turn Windows features on or off > choose Internet Information Services > OK).
We went to http://localhost and ensured that IIS welcome page was seen
We closed Visual Studio 2015 Community and reopened it as an administrator
Right click WebApplication1 project. Click Properties
Click Web on the left side menu
Start action was chosen. Ellipse (...) button was clicked and HtmlPage1.html page was selected
Under servers there's a dropdown. Local IIS was chosen. Project URL changed to http://localhost/WebApplication1
Click on create virtual directory. Successful message was noticed
Save the project changes
Press F5
Page appears as desired on http://localhost/WebApplication1/ URL
https://chat.stackoverflow.com/rooms/97122/discussion-between-dcr-and-zedfoxus has some more things that could help others troubleshoot similar problem.
Attempts were made to review answers from Unable to launch the IIS Express Web server source as well.

I found the issue to be an issue with my html source and where I was placing my Scripts.Render() and Styles.Render() methods. I placed each method outside of the html tags. Looking at the source from Firefox showed me that there were some html tags that were incorrectly closed. So I placed the #Scripts.Render() methods within the body tags and the #Styles.Render() methods in the head tags and the Browser Links started working again.

For the one who is still not getting in the visual studio like i wasn't before, try the following steps which worked for me.
install browser-sync if not installed globally through npm refer here
open a command prompt in the folder where your code is residing & run following command:
browser-sync start --files="**/*"
you will get dashboard link of browser-sync running locally. Go their and grab piece of code which needs to be embedded in the html file before body tag.
once you do that, and open your html, you will get the following message on the page & visual studio detects your browser as connected.
Don't know whether this is bug in VS or something.

Related

Configuration Error related to targetFramework in web.config

I have made an MVC website in Visual Studio 2015 and it works in my localhost. But when I published my website and put into my host, it doesn't work. It gives me this error notice:
Server Error in '/' Application.
Configuration Error
Parser Error Message: The 'targetFramework' attribute in the
element of the Web.config file is used only to target
version 4.0 and later of the .NET Framework (for example,
''). The 'targetFramework'
attribute currently references a version that is later than the
installed version of the .NET Framework. Specify a valid target
version of the .NET Framework, or install the required version of the
.NET Framework.
Source Error:
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.
Source File: G:\xxx\xxx.com\httpdocs\web.config Line: 24
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.34248
Related parts in my web.config:
<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>
And this part with error:
<system.web>
<authentication mode="None" />
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.6" />
<httpRuntime targetFramework="4.6" />
</system.web>
Properties of my website:
And NuGet Package Manager:
EntityFramework Reference Properties:
Default Web Site Basic Settings: (To be honest, I am not sure whether I should add a new website(my website) in here.)
My installed .net frameworks:
My publish method:
I have investigated this problem on the Internet and I have found several links related to my problem: Asp.net MCV4 framework issue. In this link, there are two main offers:
changing this compilation tag
updating application pool in IIS
Actually, I have tried to change this tag but it doesn't change. Then I have controlled my application pool but it seems up-to-date.
I have called my host provider and I have explained my problem. They say that this error is not related to their servers.
What should I do? What is the solution for this?
Your website project is targeting v4.6 of the .NET Framework but your hosting provider has not yet installed this version. Your options:
Ask provider to install it - they are unlikely to do this.
Find another provider that does support it.
Change your project to target v4.5.
I'm adding one more information to complement DavidG's answer. If Internet Information Server (IIS) is your provider then Web Platform Installer (an IIS extension) is a very helpful tool. It can your best bet to check the current state of what all components are installed on your machine (Refer screenshot)
It is very easy to check what all components are missing from your computer. Based on that, you can kick-start installation of any missing component through the UI of this IIS extension itself.
I just had a similar problem following the installation ( windows update) of the KB 3205402.
Big difference with my case: the application worked well before the update !
==> I found in "IIS Manager", in "ISAPI and CGI Restrictions", that the framework ASP.NET v4.0.30319 has been switched to "unauthorized" !
Switching it to "Authorized" resolved my problem
I changed:
<system.web>
<compilation debug="true" targetFramework="4.7" />
<httpRuntime targetFramework="4.7" />
<customErrors mode="Off"/>
</system.web>
to
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<customErrors mode="Off"/>
</system.web>
i.e, changed targetFramework value to 4.5 (the one supported on server) from 4.7. and worked.
had the same issue on the below line on an offline server ,
<compilation targetFramework="4.5.2">
tried adding all the roles and features related to .Net framework from the server manager and to its pool ,
but didn't work , what worked for me is just downloading Microsoft .NET Framework 4.5.2(Offline Installer)
I went round and round with this today with no resolution. Exasperated, I finally just deleted my working copy from my drive, and rechecked it out from SVN.
Fixed.
Not a particularly clever answer, but it fixed it for me, no idea what the actual problem was.
I tried replacing the targetFramework 4.5.2 to targetFramework 4.0 directly in config file. Then it and all the functions work correctly.
Before:
<compilation targetFramework="4.5.2">
After:
<compilation targetFramework="4.0">

Azure Application Insights and Web Site projects

Is it possible to add Application Insights to a Web Site project type?
In Visual Studio, the following context menu is available for Web Application projects but is missing for Web Site projects.
You should be able to instrument a Web Site project with Application Insights manually. Here are the instructions.
Just want to share what I ended up with doing. First of all, it seems to work like a charm.
The Application Insight is implemented as an ASP.NET Module, so in order to hook it up for Web Site project you need to do the following:
Add Microsoft.ApplicationInsights.Web NuGet package
Register AI module in web.config
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
Make sure you have ApplicationInsights.config in Web Site base directory (along with web.config) - it defines which telemetry you going to be collecting

The definition of this report is not valid or supported by this version of Reporting Services

I am using RDLC reporting in a ASP.Net Web Application. In development version my Reports works perfectly but when i deploy it on IIS on Server, I got the below error.
I have checked the version of Report viewer, its same...
Server Error in '/' Application.
The definition of this report is not valid or supported by this version of Reporting Services. The report definition may have been created with a later version of Reporting Services, or contain content that is not well-formed or not valid based on Reporting Services schemas. Details: Data at the root level is invalid. Line 1, position 1.
Add below dll to /bin folder
Microsoft.ReportViewer.Common.dll
Microsoft.ReportViewer.ProcessingObjectModel.dll
Microsoft.ReportViewer.WebForms.dll
Expand File Publish Options, and then check Allow this precompiled
site to be updateable.
Remove the following lines from Web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
</buildProviders>

.NET Web API 2 Project downloading browserLink.js

I've got a .NET Web API project and on load I'm getting a download of this script called browserLink.
http://localhost:49818/ea93983f23c54f35a63de09646c09159/browserLink
Its associated with .NET Signalr but I'm not using that so I'm not sure why its being included. Any ideas how to turn it off?
Disable Browser Link in Visual Studio 2013.
Do this by editing your web.config file to add the following line to your appSettings section:
<appSettings>
<add key="vs:EnableBrowserLink" value="false"/>
</appSettings>
Note that Browser Link is only used when working in Visual Studio AND the web application is compiled in debug mode, i.e.:
<system.web>
<compilation debug="true" />
</system.web>
In other words, end-users of your site will never make this request.

Report Viewer problem after moving to new server

I have just moved a site from a Windows 2003, IIS6 SQL 2005 server to a new one with Windows 2008, IIS7 and SQL 2008.
I am having problems with the Report Viewer.
I have installed the Report Viewer Re-distributable (I've tried 2005, 2005sp, 2008 and 2008sp)
I've Mapped a handler in IIS for
Reserved.ReportViewerWebControl.axd
to type
Microsoft.Reporting.WebForms.HttpHandler,
Microsoft.ReportViewer.WebForms,
Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a
However whenever I run a report on the website I get the following error message:
Could not load type 'Microsoft.Reporting.Microsoft.Reporting.WebForms.HttpHandler' from assembly 'Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'Microsoft.Reporting.Microsoft.Reporting.WebForms.HttpHandler' from assembly 'Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I am stumped. Any ideas?
I think you need to map to version 9.0.0.0 and not 8.0.0.0
you need to sure this setting should be in your live server web.config
<compilation debug="true">
<assemblies>
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
</httpHandlers>
If you are running under IIS 7 it is worth checking the handler also has permission to execute.
After setting mine up I could see the handler was just throwing a 500 exception, on closer inspection it seems just adding the handler to the list is not enough. You must also edit its permission becuase by default it is not allowed to execute. Ticking the box to let it execute, and solved my problem immediately.
Also might be worthwhile trying this if any of the other suggestions here don't work -
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/0152bb52-988d-43f5-9c3d-8d33512f46de/
"There were a number of problems with the Transition to IIS 7.
Considerable debugging was required.
FIRST ISSUE RESOLVED: Directory permissions for the IIS 7 application
pool identity (the default was Network Service) needed to be added so
that the IIS application pool could have access to the physical path
of the Website directory.
SECOND ISSUSE RESOLVED: A line needed to be added to the ASP.Net
application web.config file. Child of After
Added:
THIRD ISSUE RESOLVED The Default App pool upon install has .Net
Framework 2.0 as default. This was fine. The Default App pool setting
for Managed Pipeline Mode needed to be changed from 'Integrated'
(default) to 'Classic', this was the quick fix to keep my app running
as it had on IIS 6."
Changing managed pipeline mode to "classic" fixed it for me.
Looks like this issue has been resolved for a while now, but for anyone searching:
Note the assembly being referenced in the error:
Microsoft.Reporting.Microsoft.Reporting.WebForms.HttpHandler
It should just be Microsoft.Reporting.WebForms.HttpHandler - how we both ended up with that in our web.config is suspicious, but may have something to do with manually creating the handler in IIS and letting IIS write the handler key to the app's web.config (now of course I can't reproduce it).
For anyone moving to IIS7, bear in mind that the handler mapping now lives in <system.webServer> <handlers> and not <system.web> <httpHandlers> as it was in earlier versions. IIS7 will ignore the old httpHandlers section but you may be checking the settings there out of habit and getting frustrated that your settings aren't taking effect.
Just include CommanClassLibrary.dll in your project's Bin Folder and make sure on aspx page and config file your ReportViewer Web Control version should be same

Resources