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
Related
I am trying to host a asp.net mvc web application on iis but having this error
Now the problem is that it does not have any error in the Config Error: section. I have given the permission to the folder for IIS_IUSERS but still no success. I have almost every solution I come accross on internet, but nothing is solving my problem. My config file is this
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\CECDashboard.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables />
</aspNetCore>
</system.webServer>
</configuration>
I have also tried changing DefaultAppPool .NET CLR from v4.0.30319 to v2.0.50727 but still no success.
I have also tried pass-through authentication and specific user but both with the same results (no success)
Please suggest me something. I will be very thankful.
It seems that this is not an Asp.Net Core application, just Asp.net framework MVC application.
Asp.Net application requires certain windows feature to run it. please enable the Asp.Netfeature in the windows features.
If the web application is indeed a DotNet Core MVC application, please consider installing Asp.net Core Hosting Bundle, which includes the DotNet Core Runtime and IIS support.
https://dotnet.microsoft.com/download/dotnet-core/current/runtime
Feel free to let me know if the problem still exists.
We have an internal ASP.NET web application - it's hosted by IIS but embedded into Sharepoint via Web Parts. It needed some tweaks, so I made the tweaks and tested it all on IIS Express via Visual Studio; all is well.
I've come to deploy the app onto a newly built UAT server (since this app didn't have one existing), and there I run into problems. Certain data is stored in HttpContext.Current.Session["__MySession__"] - for example a drop down control might be set to a particular value which is then stored in the session to persist across page refresh. The problem is that when embedded in Sharepoint, that persistence doesn't seem to work (and so the application behaves strangely). When you access the application directly by navigating to its address, everything is fine.
Now; the production Web App does not have this problem, even when embedded into the UAT Sharepoint site. That being the case, I'm pretty certain that the problem lies in how I've configured IIS. I can't see any difference between the UAT and Prod servers though, so I'm lost for ideas about where to go from here.
What could cause the application to "forget" its session state in this manner? Particularly only when embedded into Sharepoint?
Try to set the below code in your web.config file:
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=*******" asyncTimeout="7">
and
<modules runAllManagedModulesForAllRequests="true">
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</modules>
You could refer the below thread for more detail:
https://sharepoint.stackexchange.com/questions/83784/session-and-httpcontext-not-available-in-web-part
https://social.technet.microsoft.com/Forums/msonline/en-US/3145fd29-2315-42f7-8f9d-cf6d52dc3c95/enabling-session-state-in-sharepoint-2010?forum=sharepointgeneralprevious
I use Visual Studio for Website development (VS 2010 Ultimate and VS 2012 Professional). To be more specific, I created this website by File > New Web Site, so I do not believe this is a project.
While developing the website, I have debug="true" enabled in the web.config file. When I publish, I manually change to debug="false".
<configuration>
<system.web>
<compilation debug="true" strict="true" explicit="true" targetFramework="4.5">
</system.web>
</configuration>
There are two config files in the solution: "web.config" and "web.Debug.config".
This is what the various forum articles and "Programming ASP.NET" books say to do, but I wonder if there is a way to have debug="true" for local development and automatically switch to debug="false" when using Build > Publish Web Site so I don't have to manually change the web.config file?
According to this forum answer, "There is no way to have a Release configuration for your website."
Keeping in mind that this is a Web Site and not a project, it looks like adding another config based on comment suggestions might not be possible. A possibly valid answer is "no, it is not possible in this context."
Is there another way to achieve the intended outcome without using the current workaround of manually changing the debug setting?
Sorry, it's related to it being a "web site" type project, which aren't compiled:
Configuration of publishing an ASP.NET web site
To quote the previous responder above:
"Web Site projects don't have the Release configuration available, but it makes no difference since they are not compiled. Web Application projects, on the other hand, do get compiled and have both configurations available."
According to the available references, for "ASP.NET Website" it is not possible to have a separate release configuration.
So the answer to the posed question is no: it is not currently possible. Manually changing the debug attribute when you publish and then changing it back is the only option in that case.
How can you proceed? If you really need to have a release configuration and a debug configuration, the a possible option is Converting a Web Site Project to a Web Application Project. While not a direct answer to the presented question, it is an alternative.
For some projects I've set up an Environment appSetting and scoped all other keys off of that Environment.
For instance:
<add key="Environment" value="Development"/>
<add key="Development.Title" value="My Dev App"/>
<add key="Production.Title" value="My Production App"/>
<connectionStrings>
<add name="DbContext.Development" connectionString="Initial Catalog=DatabaseDev;...."
providerName="System.Data.SqlClient" />
<add name="DbContext.Production" connectionString="Initial Catalog=DatabaseProd;...."
providerName="System.Data.SqlClient" />
</connectionStrings>
Then you would create a Configuration class that would pull appSettings and connectionStrings by looking for:
appSetting
string.Format("{0}.Title", ConfigurationManager.AppSettings["Environment"])
connectionString
string.Format("DbContext.{0}", ConfigurationManager.AppSettings["Environment"])
Not perfect but this will let you only have to replace one web.config value instead of a bunch without the help of the Publish config transform.
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.
I have 2 ASP.NET apps, 1 WebForms and 1 MVC. Combres worked beautifully for both while working locally on IIS Express. After deploying both apps to the test server (IIS 7, both apps are in the same web site in IIS) the combres.axd link referenced in the pages of the WebForms app is returning a 404, while the MVC app works fine.
I hooked up the the WebForms app to my local IIS as well and it again worked fine.
I looked at the modules and handlers between my local IIS, the MVC app and the WebForms app and the routing registrations appear to be the same.
If I set defaultDebugEnabled="true" then it generates a script tag for each script in the resource set and works fine.
Any ideas how to debug the 404 from combres.axd?
Tracked it down to the modules config in web.config:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
I am working with a legacy WebForms app that was created around .NET 3.0/3.5, so I did not have the runAllManagedModulesForAllRequests attribute set. I see in the latest Visual Studio 2010 ASP.NET WebForms template, this is now the default.
I also found a post that suggests a less brute force method to get the UrlRoutingModule to catch the combres.axd route.
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
One of the comments mentioned this update, I haven't tested it yet though:
http://support.microsoft.com/kb/980368