How to debug an asp.net application on live server [closed] - asp.net

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have an old asp.net web application based on .net framework 1.1, it has been deployed to live server for many years, right now I am having some issues with the live site only, the development version on my desktop works fine. So I am thinking about attach a remote debugger to the live site and monitor what happened exactly on live server, but I don't know how to do that.
I used remote debugger before, but that was used when I created new project on some development server in local LAN, and the source and project is actually on the remote server, I just attached remote debugger from my desktop to that server, it works fine. But I am not sure how to debug a application on live server.

Well yes it is possible, but is more involved. You would need to attach to the IIS worker process running the website( w3wp.exe). I haven't done it very often, and I usually try to avoid it, because while you are attached no one can access the website.
Here is an article that explains the process.
http://www.codeproject.com/KB/aspnet/ProcessAttache.aspx
The article is based on 2.0 not 1.1, but it should still give you an idea of how to do it. I suppose you will have to have visual studio on the production server.
If this is not feasible and you have access to the code, you could also try logging to a text file at certain points in the application. I have done this very effectively to find issues, which allows you to let the website run as normal and just check the log file after you know the problem has occurred.
You may want to check out log4net, which is a free logging application.
Good luck

Well, why don't you try to enable tracing on the server? Then you can see all of the information in a separate page? To enable in the web.config:
<configuration>
<system.web>
<trace enabled="true" pageOutput="false" requestLimit="40"
localOnly="false"/>
</system.web>
</configuration>
Then load the trace.axd page in your website to see the page level data.

Related

Dynamically updating an asp.net application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How could you update asp.net application from a central location. I would like to publish the final updates to a central location and have all the sites download latest updates from that central location.
Its like having ur wordpress site getting the latest version for word press ur yahoo asking users to migrate to the latest version.
You can use tool you buy, or try to write your own scripts. Writing them for yourself is not that hard.
From tools I know of Octopus Deploy or Redgate Deployment Manager (RedGate bought Octopus' sources and now sells as it's own project with some modifications/additional features). With those tools you install their agent on target servers to be able to deploy new versions of your web sites to those servers. Octopus works in both push and pull model. I don't know about Deployment Manager.
In my work I publish using self written scripts that are configured as Jenkins jobs. One click and new version is installed. This is a "push" update.
Remember that in order to update the web site without users noticing (no technical break) you need at least two servers and load balancer and a shared state service. Before deployment you need to reconfigure Load Balancer so that it routes all requests to one server. Then you update that server. Now reconfigure Load Balancer so that it routes all requests to the updated server, and update the other one. After you update all servers reconfigure Load Balancer again so requests are routed to all servers.
There are two main approaches:
The first is to "push" the updates, such that when you upload a new release it will contact each website (such as sending a request to a trigger URI) causing each site to download-and-install the update you've provided. This would require your central update site to maintain a database of sites to inform about an update.
The second is to have the site's code include a check (on a separate thread so it doesn't block any page requests) that it hasn't been n days since it last checked for an update, and if so, to check with your central server for an update, and if applicable, download and isntall it. This approach means that your central server does not need to be aware of consuming sites, only vice-versa.
Recently I have done same thing. But in my approach application does not ask user to download the latest version. It directly download the latest version. What I have done :
Create a webservice in your application. Which will receive data and directly update the database or any other part of your project.
2.Then you have to create a windows application which will be installed on your server.
And it consume the webservice of your application in client machine. Now just write a scheduler in your win app that will start every night or whatever you want. Whenever it will start, it call all the services and send them the updated data. And your service will receive this and update the application.
Let me know, it helps or not

HTTP Error 503. The service is unavailable under simple ASP.NET 4.0 web site [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
The community reviewed whether to reopen this question last month and left it closed:
Original close reason(s) were not resolved
Improve this question
Something strange happened on my local laptop: my web site that worked locally for a long isn't launched...
Trying to localize the problem I've created a simple web site with 'index.html' file only. It works fine under ASP.NET 2.0, but when I switched App Pool to use 4.0 - it stopped to work.
When I open web site in browser it shows the following error:
Service Unavailable
HTTP Error 503. The service is unavailable.
And causes App pool to stop work also... In the system event log in "applications" section I have:
The worker process failed to initialize correctly and therefore could not be started. The data is the error.
Please advise. Can't find anything related in Google... :(
P.S. I have VS2010, Windows Vista x64, last updates installed, VS SP1 is also installed...
I had to start the application pool that was set for my website and was automatically stopped on some error. (IIS (7.5 in my case)->Application Pools->Start stopped application pool.)
I've reinstalled .NET 64 - that helped.
P.S.
It seems like either some files in "C:/windows/Microsoft.net/Framework64/v4.0.30319/" folder or I removed them myself (VS sometimes complains on files in "ASP.NET Temporary files" and their deletion helps)... Probably I didn't pay attention that those folder not a temporary...
P.P.S.
In this case, why VS complained on files in "C:/windows/Microsoft.net/Framework64/v4.0.30319/" folder... ok, now it's hard to say.
Sounds like you forgot to enable .Net 4 extension on the IIS. Try finding and enabling it in ISAPI and CGI Restrictions
http://blogs.msdn.com/b/rakkimk/archive/2007/08/17/iis7-where-is-the-web-services-extensions-option-which-was-there-in-iis6.aspx
Based on the comment it might be that part of the framework was removed and in that case it might be wise to reinstall Framework 4 by first cleaning it up. Try this blog post which got a reference to a tool that automates cleaning up proccess http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx
There are subtle changes between ASP.NET 2.0 and 4.0 regarding application start up. For instance, you may not access the HttpContext object during the Application_Start event in ASP.NET 4.0. Do you have any code that might hide an exception being thrown because of this?
There are a few problems that may cause the AppPool to stop. One which I've run into myself is that any unhandled exception on a thread other than the request worker thread will cause the AppPool to eventually stop. This is not an immediate problem but eventually it will stop. The ASP.NET runtime keeps track on how frequently your app is failing and if it breaches that threshold the AppPool is stopped, taking down with it, any applications sharing that pool. A StackOverflowException or OutOfMemoryException will eventually have the same effect, these are critical errors and shouldn't be happening in your everyday production code.
I would review the changes between ASP.NET 2.0 and 4.0 and look for unhandled exceptions. You can also change the way Visual Studio handles exceptions (check under Debug > Exceptions) and break when they are thrown regardless if they are handled or not, this is a quick but very verbose way of finding any exceptions.
I'd recommend checking the security permissions of the folder used as the site's root. The launch of the worker process is probably failing because it can't read web.config in this folder.
If you're creating a new application in the IIS manager, by default it will create a new Application Pool with the same name. The problem is that this pool runs under a new identity named IIS APPPOOL\yourSiteName (in the Application Pools page this is listed generically as ApplicationPoolIdentity).
This identity does not exist until the pool is created, so the folder is not currently granting read access, and then the worker process fails since it has no access.
If you wish to use this identity you can use the Edit Permissions item on the site's context menu and access the Security tab, edit the folder's Security item directly via Explorer, or use tools like icacls.exe from the command line (recommended for repeatability).
You can also change the pool's identity to be Network Service or a specific user. I would strongly discourage the use of Local System as it grants too many permissions, and Local Service has other restrictions.
NOTE: If you are going to add the ApplicationPoolIdentity in the Security dialog, the IIS APPPOOL accounts don't appear if you use the Advanced/Find options. You have to manually type the whole "IIS APPPOOL\yourSiteName" string, then click the Check Names button to validate - if it is valid the dialog replaces your text with just yourAppName, underlined.
Go to IIS and change the Application Pool to DefaultAppPool for your web application.
I had to update my network credentials and havn't updated the "PhysicalPathCredential" for the application under IIS. That fixed.
my only problem was the Application Pool, which showed the stopped icon.
I pointed my Application to another AppPool and it's back working. Hope it helps.
I think in this case if you go to application pools under ur IIS. Look for the application pool on which you are running your website. I am sure it is stopped so just restart it and you will be good to go..

Automated creation of IIS 6.0 websites [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
We have web application portal that hosts multiple applications each in with its own IIS Website. So each time we adopt another machine to run our code, either developer workstation, or server, we have to manully create all of the websites for each of our applications, (and of course the list just keeps on growing). Is there an API call to create an IIS website, so that I could store all the necessary info in a database table and then write a winforms program that would check the table, and automagically create one IIS website for each record?
If you wanted to do this in a WinForms/Console application then I'd highly recommend looking at the System.DirectoryServices namespace.
There's some good documentation here:
Using System.DirectoryServices to Configure IIS (MSDN)
For example, to create sites and virtual directories:
Creating Sites and Virtual Directories Using System.DirectoryServices (MSDN)
The System.DirectoryServices namespace is a managed wrapper around the ADSI API's that the various IIS administration scripts use.
For more information on the various metabase properties you'll encounter I recommend this reference:
IIS Metabase Properties (MSDN)
If or when you move onto IIS7 then I recommend taking a look at the Microsoft.Web.Administration namespace and the APPCMD tool.
When IIS is installed onto a server, there are a number of scripts installed as well.
The one to look at is IISweb.vbs as this enables you to create a website from the command line. It's typically located in your %Windows%\System32 directory and you can run it from a command prompt using Cscript iisweb.vbs sitename /d hostheader
If you need to set further parameters on your website, then there are a couple of ways of doing it, either use the adsutil.vbs utility script or create your dummy website, export the settings to a file (save configuration to a file) and then when you need to create a new website, get your program to edit the settings and then import the configuration as a new website.
A good place to look for some of this is in the IIS 6.0 Administration guide
Obviously to do this, you will need to have the appropriate permissions on the servers where you are creating the new websites
Another useful script is adsutil.vbs in C:\Inetpub\AdminScripts
What version of IIS are you using? For IIS 6:
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d3df4bc9-0954-459a-b5e6-7a8bc462960c.mspx?mfr=true
You can use SDC Tasks Library for that purpose. Here is a little manual.
I was looking for the same thing and I found sample code that creates a website in iis7 using C# and the Microsoft.Web.Administration API. Add a reference to C:\Windows\System32\InetServ\Microsoft.Web.Administration.dll in your visual studio project and run the code.
http://bloggingabout.net/blogs/dennis/archive/2008/05/16/programmatically-creating-an-iis7-site.aspx
You can create installators for your WebSites and run this insallators manualy or in batch. To create installators you can use WiX link text or standard Visual Studio Setup Project. Wix is more powerfull, but easiest way to start is to creating Visual Studio Installation project .

IIS 7 - Windows Authentication not working [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
We have several web apps that use Windows Authentication that worked fine on IIS6. After deploying them to IIS7, Windows Authentication no longer works (we get 401.2 errors) UNLESS we set the web app to use the "Classic Pipeline"
I realize that Forms auth and Windows Auth aren't simultaneously supported as mentioned here and here - but that is not my issue - I dont have Forms Authentication enabled. I only have Windows Authentication enabled - but I am always getting the 401.2
Has anyone run into this? Is there something else I need to do?
Thanks!
-Mike
There are two immediate thoughts: (1) is Integrated Windows enabled on the server as a feature in the role (2) is the authentication configured in the right part of web.config? IIS7 stores some of its configuration is web.config, and moving from IIS6 to IIS7 often involves adding extra information.
See also: http://forums.iis.net/t/1153827.aspx
A lot of the settings in the web.config move from system.web to system.webserver when changing from classic mode to integrated mode. For example custom httpmodules move into system.webserver. Do you have any httpmodules that are handling custom authentication?

Debugging with VS2008 will not work after changing Hostname

I am currently using Visual Studio 2008 on XP Pro SP3.
Developing against http://localhost/ everything including debugging works fine.
I need a second website on my machine. IIS 5.1 only allows one website at a time so I used the JetStat XP Pro IIS Admin tool to create a second website. This runs by stopping the Default website and starting the other.
I have added the new website name into the Hosts file and mapped to 127.0.0.1.
Websites can be accessed via this address http://NewHostname/VirtualDirectoryName
Projects can be started without debugging (Web Applications & Websites).
However, when I try to debug I get an error: "Unable to start debugging on the web server. An authentication error occurred while communicating with the web server."
Integrated Authentication is enabled in IIS.
I have seen a lot of documentation with many fixes for "unable to start debugging on the web server" errors but they all seem like huge overkill for my problem, after all, debugging works fine provided I'm not doing it on this different hostname. They talk about doing things that I would do if debugging did not work at all even with http://localhost/.
Is there a place where I can just add this new hostname so that VS debugging is allowed? Do I need to change permissions somewhere? I feel like there should be a really simple solution that I'm just overlooking.
Here's a description of the problem: http://blogs.msdn.com/webdevtools/archive/2008/08/13/debugging-a-website-with-a-host-header.aspx
And here's the recommended registry workaround: http://support.microsoft.com/kb/896861
Do yourself a favour and download IIS Admin .NET.
This handy little tool allows you to switch between your websites at a snip - each one will become localhost when activated, and crucially, get you out of this debug debacle.
http://www.codeplex.com/iisadmin
You do have to add the hostname to a value within the registry.. but I can't remember where.
Since you can only have one website running at a time, why don't you just have them all running as 'localhost'? This way you don't have to change any annoying registry settings but you still have your applications running in individual IIS Websites.

Resources