ServiceController.start() And ServiceController.stop() Are Throwing Exceptions?

Feb 22, 2011

The following code is throwing Exception. I don't get what mistake I am making in the code. I think it is of some security rights issue. If so, how can I give the security rights to any user or application to access this windows service programmatically?

Dim sc As New ServiceController
sc.ServiceName = "DataLoad"
If sc.Status = ServiceControllerStatus.Stopped Then
sc.Start()
Else
sc.Stop()
End If

Exception:

System.InvalidOperationException: Cannot open DataLoad service on computer '.'. --->
System.ComponentModel.Win32Exception: Access is denied --- End of inner exception stack trace --- at
System.ServiceProcess.ServiceController.GetServiceHandle(Int32 desiredAccess) at
System.ServiceProcess.ServiceController.Start(String[] args) at
System.ServiceProcess.ServiceController.Start() at
WEBSITE.DataLoad.Submit1_ServerClick(Object sender, EventArgs e) in C:InetpubwwwrootWEBSITEaDataLoad.aspx.vb:line 46

View 1 Replies


Similar Messages:

C# - WebResource.axd Throwing Exceptions In Web Farm?

Jan 17, 2011

We have an array of about 12 servers serving a website. Over the past few hours, one single server has started throwing exceptions for WebResource.axd and ScriptResource.axd requests.

Exception

System.Web.HttpException - This is an invalid script resource request.

Stack Trace

at System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Broken server URL

/WebResource.axd?d=S6kjkBsrIKni9uO5HCkv0c8eYObzibWXn9R6A7Yr_Fy7CW4dRFZm1HfcnUTEZ8xBYZDM-5zeTVk1tTgC1hp7d5YYw3o1&t=634308186300177825

All other servers URL

/WebResource.axd?d=yj6PW1hbOvqhMkOh2gYGlw2&t=634207187366247462

I have checked the web.config, machine.config for every server and they're all identical. The only difference been able to find so far is that prior to the problem commencing, the servers were patched, after which, the problematic server looks to be using different version of the System.Web.dll to the others?

View 2 Replies

AJAX Panel Not Throwing Exceptions?

May 13, 2010

i have just noticed something strange in some asp.net markup.

I have a standard form with a couple of textboxes and a submit button.

When clicked the code behind will attempt to perform some logic and then return.

If the input values are not valid it used to throw an exception.

The moment i wrapped the controls in an AJAX update panel and try to submit bad data, no exception is thrown and the panel returns like nothing was wrong.

Does anyone know how to return this to the previous behavior whilst keeping the update panel?

View 1 Replies

Start Stop Exe On A Particular Machine Based On Ip Address?

Oct 21, 2010

I am makiing a web application and this application will run only in LAN enviorement.what i want to do is-

there is a textbox and a button start. in this textbox i want to give IP address and on button click i want to run a exe on the particluer system ( ip given). and on stop click i want to stop the exe.

View 5 Replies

Configuration :: Start And Stop Remote IIS From Website

Sep 27, 2010

I want to start and stop IIS on remote server using asp.net website.

When i try to stop IIS on remote PC, it raises error. I am using the following syntax "PsExec \Server2 -u Administrator -p somePassword IISReset /STOP". This works fine when called within VS IDE or from another C# code. However does not work when called from within asp.net app. I am using "Administrator" as user which has Admin access to both of machines.

View 1 Replies

Start And Stop My Application When PC Starts And Stops?

Jan 12, 2011

How can I make my application installed in my PC to start(ie., to popup for username and password) when I logged in to my PC, so that I can provide my username and password to the application and log in to it,similarly like gtalk that popsup for username and password once logged in to PC?

View 4 Replies

Stop And Start IIS Programatically - Finding Quickly And Safe Way

Aug 17, 2010

My situation: when I deploy assemblies .NET in GAC, I get errors (Cannot access to xxx.dll because is in use for another process). The IIS use those dll (assemblies).

Which is the best way (more performance,quick and safe way) or all ways to stop, start IIS 6.0 Windows 2003 ? (for C#, .NET 3.5)

options, I think:

Detect IIS installed in machine.
Process.Start() using commands: iisreset /stop andiisreset /start
Use ServiceController class for get "World Wide Web Publishing Service" ( "W3SVC" )

and do stop

controller.Stop();
controller.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(timeoutSeconds));

and do start

controller.Start();
controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(timeoutSeconds));
Process.Start() using command: taskkill /IM aspnet_wp.exe /F (use w3wp.exe in Win2003)
another options that I don't know?

View 1 Replies

How To Handle Exceptions In A 3-tier Web Application - Specifically Sql Database Exceptions

Jan 26, 2010

I'm building the standard 3-tier ASP.NET web application but I'm struggling as to where to do certain things - specifically handling exceptions.

I've tried to have a look around on the web for some examples but can't find any which go as far as a whole project showing how everything links together.

In my data-tier I'm connecting to SQL Server and doing some stuff. I know I need to catch exceptions that could be raised as a result but I'm not sure where to do it.

From what I've read I should be doing it in the UI tier but in that case I'm not sure how to ensure that the connection to the database is closed. Is anyone able to clarify how to do this? Also if anyone knows as to where I could find an example 3-tier web application that follows best practices that would be great too.

View 4 Replies

Start Batch Job From IIS / Start Exe File With System.Diagnostics.Process.Start With Another Account Is Disabled?

Oct 28, 2010

What is the right approach when users (authenticated domain admins) should be able to start batch jobs (usually exe files) from an IIS (7.x) aspx (c#) page? This is an intranet site. The batch jobs have to run on the web server as Domain Admins. The website pool is executed by network service or some similar restricted account in AD.

Approaches I can think of (and their disadvantages):
1. Start exe file with System.Diagnostics.Process.Start with another account. This feature is disabled in IIS 7.x, how do I allow it?

2. Create a sheduled task and call scheduled task-api. This unmanaged dll is giving VS compiler warnings because it's unsafe to call from managed code.

3. I suppose there's a better approach, because the previous suggestions doesn't appear safe or robust.

View 2 Replies

Distinguish Between Internal Exceptions And Real Exceptions?

Dec 9, 2010

We have a asp.net application and want to implement logging. The first idea was to use the Application_Error method in the global.asax file.

The problem is that ASP.NET very often seem to throw exceptions internally that are not caused by the application and which seem not to interfer with the users normal workflow. For example we often get HTTPExceptions, UnauthorizedAccessExceptions and others caught in this method, although there is no real error in the application.

View 2 Replies

C# - Registering Routes On Session Start Not Application Start?

Jan 26, 2011

I am trying to register the route collection in .net based on each session. The code I have works fine, you goto website/username and it loads the correct sub pages, but you have to restart the application to goto website/username2 to load those sub pages. But when the application is restarted the second one works, but then not the first one. Is there some way to create a different route collection per session not per application using system.web.routing.

View 3 Replies

C# - Start Timer On Web Application Start

Jun 8, 2010

I would like to start a System.Threading.Timer in my application when it launches (maybe deploy is the correct word). I have seen that you can use Application_Start() but this is only fired once the first request comes to the application. I need the timer to start as soon as the application is running so that it can check for work to process even if a user is not interacting with the site. How can I get the application to start the timer once it is up and running?

View 4 Replies

Iis7 - Unable To Start Debugging On The Web Server - Couldn't Start Debugging VS 2010 - II7 - Win 7 X64

Jan 11, 2011

I am running Visual Studio 2010 (as Admin), IIS 7 on Windows 7 x64. I am able to run the ASP.NET web site in IIS 7 without debugging just fine, but when I press F5 to debug it, I get: Unable to start debugging on the web server. Could not start ASP.NET debugging. More information may be available by starting the project without debugging. Unfortunately the help link is not helping me much and leads down a heck of a large tree of things. I checked the following:

Security requirements — I don't recall having to do anything special before. The worker process in IIS7 is w3wp.exe. It says that if it's running as ASPNET or NETWORK SERVICE I must have Administrator privileges to debug it. How do I find out if I need to change something here? Web site Property Pages > Start Options > Debuggers > ASP.NET is checked. Use custom server is set to the URL of the site (which works fine without debugging). Debugging is enabled in web.config. Application is using ASP.NET 3.5 (I want to move to 4.0 eventually but I have some migration to deal with). Application pool: Classing .NET AppPool (also tried DefaultAppPool). Surely it shouldn't be that hard to install IIS, VS, create a web site, and start testing it?

View 2 Replies

Force A New Start Of "Cassini" When Start Debugging A New Instance Of Web Application?

Feb 25, 2011

In our ASP.NET application we perform some initializations upon the Application Start event.When the application is started in visual Studio 2010 with 'Debug->Start new instance' the ASP.NET Development server does not start new, and my Application's Start event is not fired.My workaround is to manually stop the development server - is there a setting to force this automatically?

View 1 Replies

What Is The Point Of Throwing An Exception

Apr 15, 2010

What is the point of throwing an exception? It it anyways going to be caught in the Global.asax Application_Error method.

Lets say in the following code we throw an exception.

try {
using (var dc = GetDataContext())
{
// We are doing some data inserts here.
}
catch ( Exception ex)
{
throw ex;
}

My Question: Even if we do not use try catch and throw here, any exception which will be raised here will be caught inside Application_Error method in Global.asax. Then what is the point of try, catch and throw in this case?

View 7 Replies

HttpWebResponse Throwing An Error

Feb 25, 2010

I tried to post data to client HTTPPost URL, as per the client specification I need to post the data using "Post" method and I used the same. But it throws an error "The remote server returned an error: (500)Internal Server Error". in the HTTpWebResponse.My post URL does not have any specific page like http://abc.com/post/post.aspx. the actual URL looks like "http://abc.com/post", Can we post the lead without any specific page like I said in the above URl?

View 2 Replies

Throwing ApplicationException Not Working?

Oct 1, 2010

I am trying to throw an ApplicationException in my else statement. the error I am getting is that ApplicationException was unhandled by user code. Shouldn't the Exception just bubble up and then being handled by my exception handling code?

if()
{
}
else
{
string errorMessage =
String.Format("PayPal IPN Transaction Type not found - PayPal_SubscriptionID = {0} UserID
= {1}", _ppp.Subscr_ID, _ppp.Custom);throw
new
ApplicationException(errorMessage);
}

View 2 Replies

Throwing Exception To Get A Message Back To UI?

Feb 3, 2010

I have an asp.net application with separate classes for business logic and database interaction and then of course the UI. I am building a form to add a widget to a widget list table in the database. My UI collects the information and submits it to the business class. I'm going to write the business class to first double check that the widget has a name (I know I should do this in UI with validation, and I will, but this is just in case validation is forgotten) and if it does, go ahead and send the information to the database class. The database class will then attempt to write the info to the correct table using a try catch finally block. Any errors caught here are logged and then rethrown so I can inform the user. So, knowing that my database class may rethrow an error, my business class code will also be written in a try catch finally block.

So at this point I have a number of possible outcomes that I want to inform the user via the UI:

1) Everything was fine and the widget was added.

2) Something happened with the database write and the user should try again later.

3) The user forgot to name the widget.

My question is: should I write my UI in a try catch block and then throw a custom Exception with an Exception.Message in the business layer if anything goes wrong, or just have my business logic return a string that is the message? I'll want to know if the process was successful or not, because I'll want to format the actual message differently, so I'd have to use if...elseif to determine if the message was bad or not.

It seems like throwing a custom Exception in the business layer may be a good way to tell the UI something bad happened. If the UI doesn't catch anything then of course the operation was successful. Then again throwing an exception for missing data seems a bit hefty.

View 6 Replies

Substring Method Throwing Error

Nov 19, 2010

I am using Substring method on a string variable.

Code:
fileName.Substring(67, 18)

I get this error

System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length

Don't know the reason. I debugged a lot and going crazy about this error.

View 6 Replies

VB.NET AddHandler Throwing Object Reference Not Set?

Mar 5, 2010

I have an ASP.NET page with code-behind in VB.NET. On the ASPX page I have a Repeater with an asp:ImageButton inside the repeater and I want to catch the clicks on the button. As far as I read I have to use FindControl and then handle the copy of the original control:

Codebehind:
Dim imagebutton1 As ImageButton = repeater.FindControl("btnImage1")
AddHandler imagebutton1.Command, AddressOf ReportTransfer
...
...
Protected Sub ReportTransfer(ByVal sender As ImageButton, ByVal args As CommandEventArgs)
...
End Sub

ASPX page:

<td>
<asp:ImageButton runat="server" ID="btnImage1" ImageUrl="~/images/icons/icon_small.png"
CommandArgument="3" />
</td>
</tr>
</ItemTemplate>

It throws "Object reference not set to an instance of an object" on the AddHandler line and I have no idea why it is doing it (I'm a bit new with VB.NET)

View 2 Replies

Using Devexpress HtmlEditor Control Has DXR.axd Throwing 404?

Oct 8, 2010

I am using a dev express control: ASPxHtmlEditor version 10.1. I am trying to create a simple that only has this control. Unfortunately the control does not render with any of its styles or images loaded. This happens over 20 times. The control does not have any of its styles and all of its images do not load on the control.

I am getting 404 exceptions similar to: "Failed to load source http://localhost:11238/DXR.axd?r=5_0"

View 2 Replies

C# - Page Methods Throwing Undefined?

Dec 1, 2010

I am trying to use page methods to call a function and I am getting a "PageMethods is undefinded" error. I have used them before whilst using C# but not VB so I'm wondering if my syntax is wrong as all examples I can find are C#.I am also wondering if it's because my scriptmanager is on the master page?I've read about this error everywhere but everything I have appears to be correct!

My code:

Part of Master Page

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" EnablePageMethods="true" >
</asp:ScriptManager>[code]....

View 2 Replies

ToolkitScriptManager Throwing Exception On Calling Page_ClientValidate

Jan 17, 2011

I am using AjaxToolkit 4.0 which suggests to use ToolkitScriptManager in place of ScriptManager. But when I am using ToolkitScriptManager, it throws javascript exception when Page_ClientValidate() in called from javascript. However, this error is not coming when ScriptManager is used. Can anybody tell me how to make Page_ClientValidate() run when using ToolkitScriptManager?

View 1 Replies

App_offline.htm Throwing HTTP 500 Errors On Production Box / How To Fix It

Feb 8, 2011

I have created an app_offline.htm file for an ASP.NET MVC2 application running on IIS7 / Win2008 64-bit, and ensured that it's over 512 bytes (it's 2KB right now). On my dev box running Visual Studio 2010, it works like a charm, but when I put it on the production box, all I get is the generic HTTP 500 error saying "The page cannot be displayed because an internal server error has occurred."

What's especially strange is that I don't get anything logged in the application event log, nor does ELMAH pick anything up. I've disabled custom errors, put FormsAuthentication location exceptions for the file, ensured I'm not referencing any other files (images, etc.), but nothing fixes it.

View 1 Replies

ListView With DataPager Throwing Error After Going To Next Page?

Sep 7, 2010

I have a problem in ListView with DataPager.

[code]....

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved