I've logged into the visual studio as a different user while debugging the project encountered with error as:
"Windows service start failure"
But when I run with my own credentials working fine. I've tried by giving admin permissions to the particular user on the service but the result is same as below.
Can anyone help me on this?.
click here to see the issue
Ensure your service has a 'ServiceProcessInstaller' (right-click designer-surface of your service.cs and select 'Add Installer'), then change the account property for the service process installer to whatever suits your needs best (Network Service, Local System or Local Service). You may also need to specify the startup type of the service installer class.
To install it do the following steps:
Run Visual Studio Command Prompt as administrator.
Change the directory to the output directory of the service (where the executable file is located) - 'cd C:\directory'
Perform the following command 'installutil service_name.exe'
The service should then startup based on the startup type you specified. You may need to start it manually.
Related
I'm following Microsoft's tutorial on the topic here but it's not working and several items are unclear to me.
http://msdn.microsoft.com/en-us/library/ms733766.aspx
In step 2 it says, "ensure that ASP.NET has access to the contents of the folder". How can i do this?
Is it correct that the .cs code not be compiled? I've never ran .cs as a script of any kind.
Here is my error:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Thanks.
Could you please ensure that your apppool in which your site is running in "Integrated" mode rather than Classic.
If the problem is not resolved after doing this, try to register your IIS with .netv4.0
For doing that
Go to Command Prompt
Go to the location C:\Windows\Microsoft.NET\Framework\v4.0.30319
Register the IIS using aspnet_regiis -i command
Open IISManager and go to handler mappings and right click on the static file and select "Revert to Parent"
You can Host a WCF App/Service in IIS as you host simple website. It seems to me that you are trying to access/browse .cs file. If so, then it is not possible as it is code file. You should browse only your service file i.e. .svc file.
You can refer http://adarshdchaurasia.wordpress.com/2013/09/26/create-restful-wcf-service-api-using-get-post-step-by-step-guide/ to create a WCF service.
Please ensure that:
You have .Net framework 4.0 installed and enabled on your machine. If
not, install or try to re-install. Sometimes re-installation fix the
unknown settings problem we accidentally create.
First try to host a simple demo web site to check if the problem is
with your WCF application or with hosting process your are
following.
In step 2 it says, "ensure that ASP.NET has access to the contents of
the folder". How can i do this?
I think it mean make sure your folder are accessible by the IIS_IUSRS
Check the publish folder properties -> Security tab -> group or user name.
Make sure the app is using application pool with correct .net framework version.
normally I will just set .net framework v4.0.30319
I develop one window application and I also create one service. I start the service using coding in window application, but I am getting an error like cannot open window service on computer '.'
I have used below code.
ServiceController controller = new ServiceController("SeoMozScheduleService");
if (controller.Status == ServiceControllerStatus.Stopped)
{
controller.Start();
}
If i right click on Application and click on Run as Administrator than it works fine for me...
To make this automatic every time you open the application you have to add a manifest file to your solution, then update the requestedExecutionLevel node inside the file to look like this:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
However, changing this setting will result in the system prompting you every time to run the application as administrator if UAC is enabled.
Go to
c://Program Files/ApplicationFolder/.exe
Right-click on .exe and go to Properties then go Compatibility Tab and check true to Run this Program as an administrator Level.
if you are using visual studio then close it and re open visual sudio with run it as administrator
None of these solutions helped me, because it would help if I actually had ensured I had Administrator access on the target computer first! I was taking away and giving back Administrator access to my main account using my domain admin account. When I ran some ServiceController code that was checking if a service was running on a remote computer, under the domain admin account, all was fine. When I did it as my main account, that's when it didn't work - even when running Visual Studio as an Administrator. Turns out I had been testing without my main account in the local Admin group... d'oh!
I ran into this with a scheduled task on a server--checking the "Run with highest privileges" solved it. (The service account has to have admin rights of course for this to work.)
Framework version change in the app.conf to the version which is installed on the system fixed the issue for me.
The application probably does not need to require Administrator permission. The Microsoft Management Console (MMC) (that includes the Services snap-in) does not. The manifest for the MMC has:
<requestedExecutionLevel
level="highestAvailable"
uiAccess="false"
/>
It does not have level="requireAdministrator".
See c# - How do I create/edit a Manifest file? - Stack Overflow for instructions for adding a manifest to the project.
There are very many articles about the principle of Least Privilege, including the following.
Least Privilege
What is principle of least privilege (POLP)? - Definition from WhatIs.com
What is the Principle of Least Privilege (POLP)? A Best Practice for Information Security and Compliance \| Digital Guardian
What Is Least Privilege & Why Do You Need It? \| BeyondTrust
I am getting the following error, when trying to deploy the visual studio generated Blank Sharepoint Project.
Error 1 Error occurred in deployment step 'Retract Solution': Cannot
connect to the SharePoint site: http://srv-sharepoint:35018/. Make
sure that this is a valid URL and the SharePoint site is running on
the local computer. If you moved this project to a new computer or if
the URL of the SharePoint site has changed since you created the
project, update the Site URL property of the project.
I set up a new application so have these 3 now: (Name, URL, Port)
SharePoint - 80 http://srv-sharepoint/ 80
SharePoint Central Administration v4 http://srv-sharepoint:32152/ 32152
SharePoint - Test http://srv-sharepoint:35018/ 35018
Its all on the server. And my project URL is http://srv-sharepoint:35018/
When I changed it to the admin port, it "ran" but just loaded up the admin panel.
What Am I doing wrong?
Add the current user to the web content database with owner role (more).
Have you setup the hostname ("srv-sharepoint") in your network's DNS or your machines hosts-file?
To setup your local development environment to use the "srv-sharepoint" host name, you need to add the host name to your development machine's hosts file.
The file is located at "C:\Windows\System32\drivers\etc\hosts" and you need to add an entry like this "127.0.0.1 srv-sharepoint". Note that this requires administrative privileges.
You may have to disable the loopback check as well, nut I honestly can't remember if that is necessary. See this link.
1.Check the web url in properties of the solution is valid.
(or)
2. Confirm the status of "Sharepoint timer service" is active/running.
(or)
3. It may due to the error occurred in previous deployment process of the same solution. So go to the central admin --> System Settings --> Manage Farm Solutions. Find out the solution, open it and retract the solution manually. Once retraction is completed, remove it. Then try again to deploy it using your IDE, visual studio, as administrator.
Your site url may be incorrect in solution, check it as below.
1) select the project, hit f4, properties of solution will open.
2) check the deployment url in project properties.
3) update the url as per the local url.
4) save, rebuild and deploy.
It should work.
I have a Windows Service created in c#.
It's relatively simple compared to some of the other ones that I've worked on.
I built a setup project to install it for some testing.
I added the primary output from the service project and all the dependencies were added correctly.
I went to View > Custom Actions and added my Primary output to Install, Commit, Rollback, and Uninstall.
The project built and I right clicked the project and clicked Install.
The installation came back successful, I can view the service on the control panel under Add/Remove programs, but when I go into the Service Manager... nothing...
Can anyone provide some insite or anything else that may cause a successfuly installed service to NOT display on the Service Manager.
Forgive me if this goes without saying, but you haven't mentioned what code you are executing in your custom actions. Your service assembly must have a class which derives from System.Configuration.Install.Installer, and that class must have the [RunInstaller(true)] attribute on it. Within that class, you will need to create an instance of System.ServiceProcess.ServiceInstaller and System.ServiceProcess.ServiceProcessInstaller, set the appropriate parameters on those instances, and add them to the Installers collection. The ServiceInstaller and ServiceProcessInstaller MSDN pages have a very basic example, but it should be enough to get you there if this is what is needed.
Make sure you had provided some value in "Display name" property.
Use the following command "sc query <service_name>" from command prompt to see whether your windows service got properly installed. If you are not sure on the service name use the following command "sc query state= all >c:\ServicesList.txt" after executing this command search the ServicesList.txt in your C:\ drive.
If that too doesn't work try looking for the service name in registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
You said you added your primary output to Install, etc. But did you create an Installer derived class to do the actual installing of the windows service? I'm not talking the setup project itself, but in your project there should be an installer class that actually does the service install for you.
I had a post on my blog about creating a framework for easy installable services, it has examples on creating the isntaler class.
http://blackrabbitcoder.net/archive/2010/10/07/c-windows-services-2-of-2-self-installing-windows-service-template.aspx
In my case, solution of the problem was simple, i forgot to add access modifier 'Public' to the class. After adding access modifier, service is visible now in services list.
I can't seem to write to the event log in .NET. I get the following exception:
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
I don't want to access the Security log. How do I get around this error? Thanks!
You can try to Start Visual Studio with Run As Administrator permission.
You can try to create an event log in your application like Lachlan suggests but realize that this will require administrator privs. Instead I reccomend that you take care of this in your installer / deployment automation layer.
I use WiX so I recommend reading:
How do you create an event log source using WiX
Have you set the source for your eventlog? E.g.:
EventLog.CreateEventSource("My Super App", "Application");
If, for example, you are developing a service application that use EventLog class and need to test somes classes before running the service, which need to be installed. You can add a app.manifest to your project (not service project, maybe a console application), and in 'requestedExecutionLevel' set the level to "requireAdministrator", when you try to run your project from visual studio, it will ask to elevate the permissions that will (if want)i restart the visual studio, then will be can to use EventLog class.
hope this help,
antonio