|
I wrote a few new web form pages in C# 2010. I orginally tested the code in cassini and everything worked fine. I was able to set breakpoints and the code reached those breakpoints successfully.
Now I want to test the code using the local iis server and/or a test iis server that is on my workstation. I set breakpoints, but the breakpoints are missed.
When I am trying to run with the local iis, I set the build mode to debug.
Are there some visual studio 2010 options that I need to set? If so,what are they?
Thus can you tell me what could be wrong, code stops at my breakpoints while debugging is local iis?
|
|
|
|
|
Is the same work flow getting executed? Does the breakpoint given shows any error or warning of not being set properly?
|
|
|
|
|
I am working with a C#.net 2010 web form page that I wrote a couple of weeks ago. My problem is the
Response.Redirect("~/Detail.aspx"); statement.
When I first started to write this web page and tested using cassini, I had a problem with that line of code. So I changed the line of code to
Response.Redirect("~/Detail.aspx", false); and that resolved the problem.
Now I am trying run this code on an iis test server and I am getting the same error I orginally had in cassini.
I changed the line of code back to
Response.Redirect("~/Detail.aspx"); and that did not solve the problem. The web app did not go from page 1 to page 2.
Thus can you tell me what to change in this code so web page 1 goes to web page 2?
modified 27-Jun-12 0:34am.
|
|
|
|
|
First thing you should have tried to find was what does second parameter in Response.Redirect does.
It indicates whether execution of the current page should terminate or not.
Details here: MSDN: HttpResponse.Redirect Method (String, Boolean)[^]
What you did by using 'false' was to allow the execution to complete before re-direction.
Now, though you have not shared your error, I guess that you are playing with Response in your code before this re-direction which is raising some issue. You need to make sure that the execution goes smooth and you don't end the execution abrupt before redirect (in IIS case).
|
|
|
|
|
I tried all the following options:
Response.Redirect("~/Detail.aspx");
Response.Redirect("/Detail.aspx");
Response.Redirect("Detail.aspx");
In all 3 casses I am gettibng the error message:
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.".
Do you have any ideas what I should try next?
|
|
|
|
|
|
I need to force a postback from the asp code behind. Can this be done?
|
|
|
|
|
Postback's are generally triggered based on some action from user. Since you have not explained your scenario on what you want and why you are in need of such a scenario it is difficult to suggest alternative or other possible way. Right now, if you are aware of page Life cycle, all you are trying to ask/do by second postback is repeat few of already executed events and just raise the previous event handlers again.
Still if you are looking for ways to do, possible ways:
1. Raise a postback from Javascript. Use RegisterClientScript from code behind to trigger it.
2. You can do a Response.Redirect(Request.RawUrl); // transferring the execution back to same page
|
|
|
|
|
Hi
I've created a Bubble chart using Google Chart. When user clicks on a bubble I call __doPostBack() function using javaScript to post-back the selected value to the server. Here is an excerpt from my code:
chart = new google.visualization.BubbleChart(document.getElementById('chart_div'));
function selectHandler()
{
var selectedItem = chart.getSelection()[0];
if (selectedItem)
{
var value = selectedItem.row;
document.getElementById('txtDistance').value = 'You have selected ' + data.D[value].c[0].v;
__doPostBack('txtDistance','');
}
var selection = chart.getSelection();
}
google.visualization.events.addListener(chart, 'select', selectHandler);
As you can see that the javascript is assigning a value to the the TextBox 'txtDistance' (the TextBox 'txtDistance' has an associated TextChanged event) and calling the __doPostBack function to trigger the event procedure 'txtDistance_TextChanged()'
Everything works fine until I add an AJAX ScriptManager ( <asp:ScriptManager ID="ScriptManager1" runat="server" />) in the form.
Can anyone explain why is this happening please?
|
|
|
|
|
I think the ScriptManager also listens for events, so the ScriptManager thinks your event belongs to it, and can't find the handler. But I don't what the error message was, so I can be totally off base here.
This won't fix your problem, but should give you an idea of how to handle events with the script manager, where you can separate Javascript ajax from updatepanel ajax.
I wouldn't do a postback on textchanged, but instead use a button click
if (!Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(AjaxEnd);
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(AjaxBegin);
}
You may want to learn more about __doPostBack, and get a clearer understanding of it.
I've never used it, or written code like your sample.
http://weblogs.asp.net/yousefjadallah/archive/2010/06/27/insure-that-dopostback-function-implemented-on-the-page.aspx[^]
|
|
|
|
|
Hi,
I don't know if here's a correct place to answer or not but We have developed an application using ASP.Net 2008 and SQLserver2008. When we published it into a host server it was working slowly. and when we published it to another host server it times out so often and works again without making any changes to anything.
Please let me know, what would you check to resolve such problem?
any idea is appreciated
|
|
|
|
|
I would try requesting a file like robots.txt, and see how long it takes to come across the wire. If it's slow, then perhaps your service provide has you on a fully loaded server, or they are low on bandwidth.
Try it a couple of times, because the web site might be in a idle state, and will take time to load the first time.
If it's really fast, then you need to dive deeper, and test pages that use the sql server.
Other than that, there be test software out there, that measures speed.
http://yourdomain.com/robots.txt
|
|
|
|
|
Are you hosting with a commercial service, or on in-house servers? In either case, the first thing I'd do is to enable logging on both IIS and SQL Server, then review the log files for clues to where the timeouts are occurring. If you're on your own servers, it's much easier, as many commercial hosts charge extra to gain access to the built-in log functions. If you're using an outside service, you may have to fight for access and pay an unreasonable fee for the privilege of viewing what costs them nothing to give you.
If this isn't an option available to you, you may have to modify the site code to monitor and report to you the time required to complete critical steps. A little creative scripting to generate a text file of calls to the SQL Server and return times might be useful for diagnosing the problem. Add a log.txt file to your site, add code to write timestamps to it for as many calls as you think might be contributing to the problem, and download the file periodically for review. Depending on the site structure and design, you might also be able to capture all error messages and log them to a file, if they aren't being displayed to you when an error occurs.
Of course, it may be that your hosting service sucks. It's unfortunate, but some really are substandard.
Will Rogers never met me.
|
|
|
|
|
Thank you Rojer for the comments.
I have full access to the host server (it is commercial) but the problem is that the time out occurs here and there. That is, it occurs, for instance, at stored procedure 1 now and then another time it runs the SP1 well and then occurs at SP2.
How can I be sure that the problem is from the host server? As I have to prove that to my boss
|
|
|
|
|
Beats me! Can you access the SQL Server logs on the server? Are you opening connections in your app but failing to close them as soon as you're done with an action? SQL Server is a resource hog, and it's critical to clean up after yourself often. Without a lot more information, this is an impossible problem to solve form a distance. Good luck!
Unfortunately, the universal law, "All things are simple for the one who doesn't have to do them" applies, and "I dunno" isn't going to convince the boss.
Will Rogers never met me.
|
|
|
|
|
I want to be able to debug a C# 2010 web form application that runs using the local iis server. I have my breakpoints set in the application, but the code never stops at those breakpoints. ( I want to do this type of debugging since the application is going to run under iis on a test server and then in production.)
When I run the web form 2010 application using cassini in the debug mode, all the break points are hit and the code runs with no problems.
Thus can you tell me what I need to do to be able to debug my web form app 2010 using the local iis server so that I can hit the breakpoints I have set to see what is wrong with the application?
|
|
|
|
|
You have to attach the debugger to the instance of
aspnet_wp.exe that is running.
Open the site in IE as normal and set all of your breakpoints and then, from the main menu, select 'Debug', 'Attach to Process'. Select 'aspnet_wp.exe' form the list and click the 'Attach' button at the bottom right of the dialog.
Navigate to the page you wish to debug and your breakpoints should start to get hit.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
How can I 'Open the site in IE as normal' normal? I run the code in cassini in the visual studio 2010 ide and hit f5.
|
|
|
|
|
Publish your website on IIS in ASP.NET page: http://msdn.microsoft.com/en-us/libr...=vs.80%29.aspx
1. webvidu asp.net to run in normal mode and programming Publish normal website
2. Publish test their IIS under ASP.NET on IIS website, follow the instructions above also normal
3. When put up IIS and web browser they type in localhost/asp shall be the following error:
XML Parsing Error: not well-formed
Location: http:
Line Number 1, Column 2:<%@ page theme="Default" language="C#" masterpagefile="~/MasterPage/MasterPage.master" autoeventwireup="true" inherits="webvidu._Default, App_Web_default.aspx.cdcab7d2" %>
-^
I do WinXPSP2 IIS on the operating system, and use vs.net2005 13.0.1 firefox browser
so please fix this bug? thanks
|
|
|
|
|
One possible reason: Check if correct .NET Framework is selected in IIS. For example, it might be set as v1.1 right now but v2.0 is needed.
|
|
|
|
|
I do not think NetFramework because my web host is the same machine.
|
|
|
|
|
So what? In your IIS you might have forgot to set the correct Framework version. Please check.
|
|
|
|
|
I've modified the above error, machine error follows:
Server Error in '/asp' Application.
Failed to access IIS metabase.
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.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +3492170
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +163
System.Web.CachedPathData.GetConfigPathData(String configPath) +382
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3385679
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
|
|
|
|
|
|
Hi,
when I start debuge a web solution, this message appear,even if solution was a empty web form,
what should I do...?
I use visual studio 2010 & windows 7.
modified 25-Jun-12 11:57am.
|
|
|
|