Application pool account permission to run RestSharp - restsharp

Recently my web server (windows server 2012 R2) got several Windows updates. Since then I am not able to run a code involving RestSharp. It fails whenever I try to initialize "new RestRequest()". Windows event log registers this error: "User does not have permission to run the resource"
I have development environment with Windows 7 where I don't see these updates. My code runs fine.
I have looked into the update history on the server and looks like the following updates may be creating these problems.
KB3074548
KB3074228
KB3074545
I have looked into documentation of RestSharp to find out whether any specific permission needed on the application pool running RestSharp code. I could not find out anything.
I am wondering whether anyone else having this problem and/or may have any knowledge about permissions required to run RestSharp request.
Really appreciate any help.

It is now working. It was just a deployment issue.

Related

Why is transfer from test to production of Asp.Net-Core app completely not working

We've been finalizing NopCommerce .Net Core web app which has been running great on a test server. I'm now trying to transfer the app to our production server, which did not have .Net Core. I installed the latest .Net Core hosting bundle and rebooted the server. I also have Web Deploy running on both the host and the client. I exported the app from the test machine and imported it into a newly created IIS site. After setting up the bindings - and enabling stdoutlogging, I try to see what's working, and get indication that "An error occurred while starting the application". No indication what the error is. Logs is not being written to. The event viewer tells me that:
Application 'MACHINE/WEBROOT/APPHOST/NOPCOMMERCE' started process '6980' successfully and is listening on port '41573', which is a random port not binded to.
One interesting thing I noticed on the test server is a "user" called nopCommerce which has full rights to the nopCommerce folder in inetpub/wwwroot. However this user does not show when I look at local users and groups. I am not sure therefore what this "user" is and if/how I should create it. Based on some advice from somewhere I temporarily gave everyone full rights to the nopCommerce folder, but that didn't work either.
Can anybody please aim me in the right direction?
Problem was a bad setup - access rights to subfolders of nopCommerce was one, which I solved by giving the users group modify rights. This might be a bad idea and I will do some more research. The other fault was a bad database login in the connectionString.
Ultimately I had to learn that instead of starting the app via IIS, it can be run from the command-line, and then messages and errors will be displayed in the DOS box. What to run is determined from the
I still don't know where the nopCommerce user comes from on the staging server.

The remote procedure call failed and did not execute. (Exception from HRESULT: 0x800706BF)

I did ask this question at Microsoft forums but did not get any reply. I am asking here hoping to get an answer. My query is detailed below.
I have a C# application which manages user's on AD using ADSI APIs. For managing user's password, I make use of IADsUser.SetPassword(string NewPassword) of Interop.ActiveDs.dll.
The issue I am facing is only when domain controller is installed on Windows 2008 enterprise SP2 OS. It is not reproducible on Windows 2008 R2.
When I try setting the password one user by one, there is no issue at all. But if I create threads for each user and then each thread calls this API I get "The remote procedure call failed and did not execute. (Exception from HRESULT: 0x800706BF)" .
Apart from this, I do not see anything on the event viewer on the DC or anywhere. This something similar to what is mentioned here http://support.microsoft.com/kb/960007 which is for 2003, has someone seen this issue on 2008 enterprise SP2 ? Is this a known issue ?
I am installing all the updates which are pending using windows updates, hopefully it might resolve. Can someone please answer if they have seen this issue and what were the steps taken? Thanks.
I ran into something similar running an ASP.NET web application in VS 2015, AND I also had a LightSwitch application running in VS 2012 under different credentials. Rebooting did not do the trick. Enabling native code debugging did:
Debugging unmanaged code while debugging managed code
I did not do anything except turn it on. My app ran fine after that. I went ahead and turned it off and it still ran fine. Whatever works.

windows service works on XP but fails with error 1053 on w2k3 64 bit

Forgive me if this is a stupid question, I'm fairly new to writing services. I've written a service that runs a timer and the timer code runs some checks to ensure our systems are up and running. It's written in VB.Net, framework 1.1. I then install the service using "sc create". The service works beautifully on the XP Pro machine that I'm developing on. However, when I install the service on a Windows 2003 server 64 bit, the service fails with error 1053 immediately. I put some debugging in to write to a text file as the first line of code in the OnStart function but even that doesn't run, so there must be a problem in the program starting up. Finally in desperation I created a brand new Windows Service in a new VB project in Visual Studio 2003 and compiled an empty service that merely declares and sets the value of a string variable in the OnStart function as follows:
Dim strTmp As String
strTmp = "hello"
Even that failed on the W2K3 server, but works fine on the XP dev machine.
The server has .Net Framework 1.1 installed and working, we use it in our CMS (written in ASP.Net 1.1).
The service runs as the local system account. I tried enabling interaction with the desktop but that didn't help. I ran Process Monitor and there are no access denied events. I emptied the Application Event Log, still doesn't work. No other events to help me out in the logs. Definitely using the Release build of the application. Permissions on the exe file are full control for System and for Admins.
Any ideas anyone? It must be something simple, but I'm damned if I can figure it out!
Thanks in advance.
#DavidHi, many thanks for the suggestions. I donĀ“t think the first point is my problem, partly because the MS article is about stopping or pausing the service, mine fails on starting; but also because the service does not timeout, there is no 30 second wait, it fails immediately. Secondly, when you say add an exception handler to the service startup, do you mean the OnStart sub? I tried adding a debug file write in there, but I'll try adding an event log instead. Regarding the systems checks, it can't be that because the brand new empty test service I created shows the same behaviour and that does not do anything at all. You last point could be the key. My dev environment IS 32bit. I'll do some research on the corflags thing, or perhaps I can build a 64bit dev environment. Many thanks again, you've given me some new things to think about at least!
Ok, have found a workaround. I was putting my exe file in System32. When I put it in a different folder, created by myself, the service ran, albeit briefly. I then had to move the ini file and the log files that it reads/writes to that folder too, rather than System32, and all seems to work nicely. God knows why it doesn't like running from System32 but at least it works now! Thanks for the help guys.
This looks very similar to this question which might help you out:
Starting a windows service fails with error 1053
A couple of other things to look out for:
Make sure you don't have either of the following statements in your deployed service:
System.Diagnostics.Debugger.Launch
System.Diagnostics.Debugger.Break
You may need to run the service with an account other than Local System (depending upon the permissions required by your service).
The 1053 error is a timeout related to the service control manager waiting for the service to respond to your start request. There is a knowledgebase article that refers to managed service stop request issues specifically relating to Framework 1.1-based services, so it is not precisely describing your problem, but it may have relevance in your situation. The link is provided for your reference.
http://support.microsoft.com/kb/839174
The other suggestion I would make to further diagnose the issue is to determine whether the Start is failing due to a "hidden" exception occurring in your service's startup code; the start call would not see the exception and could make you think it was merely timing out.
I would suggest you add an exception handler to your service startup that does nothing more than log a message to the event log with the particulars of the exception if one is caught. That would at least give you an idea that something is going wrong specifically within the service, and give you more information than you have right now.
One last thought: Does the service check the systems you describe over a network connection? If so, LocalSystem won't have sufficient privileges to perform network access.
Good luck!
EDIT One other possibility:
Is your development environment/execuable 32-bit? You mention your server is 64-bit, so you may need to use the "corflags" tool that forces 32bit operation on your executable
corflags /32bit+ YourServiceExectubable.exe
The source for this information was the following SO post:
32-bit Windows services in 64-bit environment
**Unfortunately, it appears corflags is applicable only for 2.0 assemblies, and was designed for specifically this type of problem. **

Silverlight Application gives 4004 error when trying to use RIA services

I have written a Silverlight application that is basically an account registration form. I have been able to successfully deploy this to one of our production servers running windows server 2008/IIS7. While this took some time to do, I was able to work through and solve the issues that came up fairly easily. Now I am trying to deploy the application on our main production server. This server is running windows 2003/IIS6 and this is where I have hit some problems.
I have solved most of the issues and now the silverlight application will load and I can see the form for a few seconds before it disappears. I believe during this time it is trying to load data from the database using the RIA services.
In IE I get the following error:
Webpage error details
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Windows.Markup.XamlParseException:
System.Windows.Markup.XamlParseException:
System.Windows.Markup.XamlParseException:
Cannot find a Resource with the Name/Key ApplicationResources [Line: 6 Position: 9]
I believe it must be a configuration issue in IIS6 because the app works fine on IIS7 but I am drawing a blank as to what to try. I have spent hours trying to find a solution to this particular problem and while others have mentioned getting this problem the answers always tend to be non-specific in nature.
This is what I have done so far:
Added New Application Pool for .NET 4.
Set the website to use .NET 4 on the ASP.NET tab (nearly had heart failure when this did an iisreset).
Added the MIME types for Silverlight .xaml, .xap, etc.
Unchecked Integrated Windows Authentication (was giving an error when checked).
Give Execute permissions to Scripts and Executables.
Recycled the application pool.
The one thing I have seen suggested but have not tried is an iisreset, and while I am not entirely convinced that doing this would solve the problem, we have scheduled this to be done tonight (if I cannot find a solution before then).
So basically I am wondering if anyone out there has seen this problem and knows how to solve it?
UPDATE 1: We tried an iisreset last night and as I expected this did not solve the problem.
Okay I have solved the problem. As suggested I did a WCF trace on the application. This highlighted the REAL problem straight away, which was 'The SELECT permission was denied on the object...'. Once I fixed this the application works as I expected. It turns out that a colleague of mine had already made this permission change on our other server (running IIS7) so that was why it worked there (this is bad - I know).
Also it didn't help that the javascript error I was receiving on the client side (shown in the question) had nothing to do with the underlying issue and led me well and truly up the garden path.

ClickOnce Online-Only Application as a TS RemoteApp

I've attempted just about everything to get our ClickOnce VB.NET app to run under Terminal Services as a RemoteApp. I have a batch file that runs the .application file for the app.
This works fine via RDP desktop session on the terminal server. As a TS RemoteApp, however, well... not so much.
I get a quick flash of command prompt (the batch file) on the client system and then... nothing...
Same goes for having it point to the .application file directly (without using a batch file) or even copying the publication locally and having it point to that.
I found a technet.microsoft.com discussion about a similar issue, but there's no resolution to it listed.
For anyone who has run into this before and got it working, what did you have to do?
We currently use RemoteApp's for everything else on that server, so I'm hoping to stick with that if possible.
The current workaround is to build and run an MSI-based installer for the app on our terminal server whenever we publish via OneClick out to the network, but this can be quite a pain at times and is easy to forget to do.
Since the app works fine via Terminal Services when run in full desktop mode but not during RemoteApp, I don't think it's anything specific to Terminal Server permissions so much as ClickOnce requiring something that isn't available when running as a RemoteApp.
The Key to getting it to work is to use Windows Explorer "C:\windows\explorer.exe". This process is the base process when you login to a full session.
If you setup the RemoteApp to use Windows Explorer and the command line argument of the path to the .application file for the ClickOnce application then it will work when launched as a remote application. Windows Explorer will flash for a second when it starts, but it will disappear then the ClickOnce application will launch.
Why does it have to be a ClickOnce application? I would consider just deploying the exe file and assemblies.
I know it only half a solution, but if the application does not change much, it might be a good solution.
I believe your problem is related to the fact that ClickOnce needs to store it's data in a special user folder called the ClickOnce application cache. Apparently because of how Terminal Services sets up user folders ClickOnce can't access this in TerminalServices mode.
See this link for more information.
http://msdn.microsoft.com/en-us/library/267k390a(VS.80).aspx
There may not be a way to do it :(
Can you launch the .exe directly? It's buried under your profile in \AppData\Local\Apps\2.0[obfuscated folders], but you should be able to find it.
That will skip the built-in update process, but if it can be launched that way you could then write code to do a manual update after the application starts.
Faced the same problem this morning and got it resolved by copying the clickonce app's directory from the user settings folder to somewhere like c:\MyApp\ - I know its nasty and not very ideal.. but good enough for me!
We recently ran across this issue and decided to post a bug report on this issue to the Visual Studio development team. Feel free to comment on the bug report. It has to be a bug in ClickOnce caused by some changes in Server 2008.
https://connect.microsoft.com/VisualStudio/feedback/details/653362/net-clickonce-deployment-not-working-as-remoteapp-or-citrix-xenapp-on-server-2008-server-2008-r2
We also have a discussion on the MSDN forums covering this issue:
http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/7f41667d-287a-4157-be71-d408751358d9/#92a7e5d9-22b6-44ba-9346-ef87a3b85edc
Try using RegMon and FileMon when starting the app - You may be able to track it down to a file and/or registry permission issue.
Also maybe check the event logs to see if anything's getting logged when the process fails.