Error in Start/Stop Window Service from ASP.NET page - c#

I created a windows service in C# and it is executing fine. And i have a ASP.NET application from that i'm trying to access (start/stop) it. It was working fine in my local machine and when i deploy it in my server it was not working. when i click the button to start stop the service gives an error:
Access is denied error message'

Run application pool that hosts/runs your ASP.NET application under user who has enough permissions.
Note that it's a potential security hole!
Instead I'd add a layer like web service available only locally to delegate such task.

Related

C# Web service works in console but not from asp.net website on IIS server

I'm using a web service which works fine when I run it on my machine in an ASP.NET application using the default IIS Express VS 2010 comes with. However, when I move it to our server with IIS I get the error:
Error: There was no endpoint listening at 'web service name here' that could accept the message. This is often caused by an incorrect address or SOAP action.
'web service name here' is just a placeholder I put for this post. It has the right web service name.
So I pulled out the small login code that this is failing on into a console application and ran that from the IIS server and it worked! So I have to assume this is some kind of permissions issue with the IIS server on how it's running my web service code? In my ASP.NET program I have a separate DLL that handles the web service. The ASP.NET application fires off a separate thread that uses the DLL I made that uses the web service. Is it something to do with the separate thread permissions maybe? Any ideas?
Your first step when faced with this sort of issue is to search your config files for "web service name here" (or if this isn't actually the message you're getting the address given in the message). My suspicion is somewhere you'll have a WCF reference set up which needs a proper IP address.
Once you've got the address (assuming it looks valid) you need to check you can access it from the machine which is having the difficulties - it may be a firewall issue.
Now that you've established that your console application is connecting correctly from the same machine the next step is to check that both your IIS App Pool and Console application are running under the same user account/permissions. It may be that one identity has permission to access the network/internet and the other one doesn't.

Window application called from web page not able to set start up application

I am developing an windows form application.
And i also developing an asp web application.
From this web application i need to call that windows application.
And the windows application set start up application.
When i call this exe from aspx page it through error at setting start up application.
Error
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)
Note whenever I execute that exe manually(Double clicking on exe) it works fine.
Can any one tell me what to do in this case.
This is breaking fundamental web security.
Where's the exe? on the client machine that you're trying to access via a web page? Or is the exe server side? In which case, why's it a Windows form application when no one will ever see the GUI?
What's the purpose of the Windows form app? That functionality either needs to be encapsulated in a web page if it's consumer facing, or if it's server side handled some other way.
If the exe is installed on the client and you're trying to open it from your web page, the only way I can see how you might do this is by downloading a file with an extension that is opened by your windows form app by default for further processing etc.

call exe from wcf service

We have a WCF service that we recently switched from self-hosting to IIS-hosted. It needs to launch an executable using Process.Start(). This works fine when it's self-hosted, but when hosted in IIS, we get the error:
TimeOutException was unhandled
void notepad()
{
System.Diagnostics.Process.Start("notepad").waitForExit();
}
Any help would be appreciated. Thanks!
when you host your WCF service in IIS, being a server, IIS requires and allows no user interaction and works also if no user is logged in; in that context there is no UI to host your notepad or other UI enabled applications, you could execute a process or other batch jobs but not render a windows UI application, because Windows Explorer is not loaded for you and there is no place to render your process's UI. So you can start processes that have no UI.

IIS Access Issue

WCF Service
I am developing a WCF Service and it needs to communicate with a com application running on the system.
I have tested the service with ASP.net development server it works fine. now when i run it from IIS the service can't communicate with the com application.
Issue is IIS runs in a different user account 'Application pool', than the one user is logged in. The COM file run on the user account user is logged in. So the that is the reason they have issue communication. Or at least that what i think.
What i did was i created a new application pool in IIS and in advance setting i changed the process model identity to local system. but it did not work....
i need ideas how to make the make the com and the service to run in the same account.
Any idea will be much appropriated.
IIS not only runs under a separate account, but also runs under a separate login session that is completely separated from the interactive users session. The COM object must be possible to invoke without a user even being logged on if you are to use from IIS.

Not able to Call a webservice from VISTA

We have a webservice deployed and calling it from Windows application, it is working for everbody except for 3 users who is using VISTA operating machine when they try to access the webservice from application they get the below error
"A Required prevelege is not held by the client"
however they are able to access the webservice ASMX URL directly from browser with their credentials.
Can anyone tell me to figure out this issue
Try running the application as an administrative user and check it the problem persists.

Categories