I'm migrating a working ASP.NET web application from WS2008R2 to WS2016, but the same happens on WS2012R2. It fails when executing:
new System.Printing.PrintServer(#"\\printserver");
It throws:
System.Exception: An exception occurred while creating the PrintServer
object. Win32 error: The printer name is invalid.
printserver is not an alias but a hostname. It loads correctly on Windows Explorer. The same line works fine on a regular Console Application when compiling under the same .NET 4.5.2, and also in PowerShell when loading the System.Printing.dll. The GAC shows the right assemblies, and I've also added them manually just in case.
I've set the same application pool configuration settings from the working WS2008 (disabled 32-bit applications and Classic mode), but I've tried different combinations in any case. The application pool runs under the same domain service account on both old and new.
As some user also suggested, I've installed the Print and Document services role, even though the old server doesn't have it, but to no avail.
I'm out of ideas, any kind of help would be greatly appreciated. Thanks!
Not really a solution... But I "fixed" this by changing the path of the website in IIS manager back and forth a couple of times. Yes, after a year of trying all I could think of on several servers.
Anyway, not sure what exactly unblocked the situation, but it works for me.
Related
I have a prototype .net web site that is on Windows 10, created using C#. I am using IIS on the same machine to deploy from Visual Studio 2017. It uses SQL Server for back-end data. The site only runs on intranet.
It deploys ok, I can see all the pages, from all three of my machines. But others cannot see anything. They get a run-time error, that does not say anything specific.
My machine was re-imaged and hence the need to redo this.
I looked at IIS log and it does not have any info. What else I can look into?
In web.config, turn off custom error mode to see detailed error message on the client:
How to set web.config file to show full error message
If it works locally and not remotely, it's likely a permissions error (accessing a resource that the client doesn't have access to), or maybe a pathing issue (you are referring somewhere to something by disk or UNC instead of URL, or to a domain that only makes sense to you, like localhost).
I'm wondering if any of you can shed some light on a problem I'm having.
I had a website located on an Amazon EC2 instance, it was working with no problems however the person who set it up located it the wrong region. As a result I've set up a new EC2 instance and zipped up the website directory.
I copied it across to the new instance and unzipped it.
Then I set up the website in IIS, it has it's own username so it doesn't run under IUSR. This use has full permissions to run the website and other than location, the setup is identical to that on the previous server.
However, when I go to adjust the connection string through IIS I get a message:
There was an error while performing this operation.
Details
Filename: \?{path to web config here}
Error:
I've not seen anything like this. I can open the web config in notepad++ and make changes with no issue. But the site reports the web config as malformed. Even using the exact web config from the working server this same message appears.
I've tried re-compacting the site on the working server and transferring again with exactly the same results.
Anyone got some advice on what I could try?
I'd be willing to bet that an extra module that you had installed on the old instance is not available on the new instance; I had a similar problem when I was using ther url-rewrite module of IIS on one instance, and moved the site to another instance that did not have that module installed and got a very similar (if not identical) error message - that would explain why the config was valid on one server, but not on the other.
You need to make sure all of the 'extra' options that were turned on in the old instance are available on the new instance, and I'd start by checking the rewrite module.
Just installed our application on a client's server, and we are seeing an error that we have never seen before. This program runs on hundreds of computers and servers around the world, and apparently this one is different. Our client is fairly security conscious, so I'm guessing we need to have them unlock something, but no idea where to start. Google search of the issue only gives me a bunch of PowerShell references.
When calling System.Reflection.Assembly.LoadFile() to load in a DLL, we receive an "Operation is not supported" error.
This is a .NET 4.0 C# application.
Thanks
Went to each non-working DLL, properties, UNBLOCK. Restarted our service, and everything started working.
Whenever I debug my application (ASP.NET Web Application converted to Web Role), I am able to get to the login page. I go ahead and sign in, debug through that and it seems to work fine, but as soon as it takes me to the landing page after login, DevFC.exe stops working with the error:
An unhandled exception ('System.Net.Sockets.SocketException') occurred in DevFC.exe [8072].
Now, I've searched for the issue and have seen something about DevFC.exe crashing due to VMWare Workstation that listens on the same port (12000) and HTC Sync that also listens on that port. I have neither of those applications on my machine, so I am lost here. Using TCPView (from Sysinternals), I find no other application using that port.
The one thing I do notice is that [System Process] goes crazy creating connections to localhost:12000 once DevFC.exe gets started.
Anyone have some insight on this?
This might sound ridiculous but restarting your machine might solve the issue. If that doesn't work, try your project on a different machine. If the project works then there is an issue with your primary machine try uninstalling then reinstalling the Azure SDK. If the devFabric still crashes on the secondary machine then it's something related to your project.
You might want to take a look at the logs created in the DevFC folder here: %localappdata%\dftemp\DevFCLogs (C:\Users\[user]\AppData\Local\dftmp\DevFCLogs). This will hopefully shed light on the actual error (which in my case, was a conflict on port 12001. Ran netstat -ab afterwards and found it was vmware-hostd.exe. This is a service included with VMWare Workstation 8. I know you said you don't have that, but you may have some other conflicting software).
See this thread as well for more detail.
http://social.msdn.microsoft.com/Forums/en-US/windowsazuredevelopment/thread/7e205afd-4b9a-4387-8e10-99e4b8f27788
Solved the problem see the bottom of my post.
So I have a simple windows service that watches a specific folder and upploads files that come into it to a server using a web service.
It's working fine on my machine using windows 7 but when I try to start it on a windows server 2003, I receive an error: Error 1053: the service did not respond to start or control request in a timely fashion. But I get this message after only a few seconds.
I have created the ServicesPipeTimeout and set it to 60000 milliseconds.
I have tried running it from command line using sc query command and found out that the WIN32_EXIT_CODE is 0, which I think means that the service doesn´t even try to start because it find an error before it starts.
In the event viewer I get errors 7000 and 7009.
I am the Administrator on the windows server.
The only thing I haven´t tried is a hotfix I found from microsoft but I don´t want to use it because as I understand it, it is for when the service actually times out.http://support.microsoft.com/kb/886695
I have tried everything I can think of, is there anything that I am missing?
Gísli
EDIT: Re-installed the .NET framework and now I get a new error, Saying that the service controller can not be found.
EDIT: I setup the service with a setup project, not using the installutil command. This is because I need to get user input during the installation and save that in the registry.
EDIT: I have installed the .NET 4.0 framework, it wasn´t possible to install the service with out doing that.
In addition to what I wrote above I have also tried:
Rebooting.
Re-installing.
I have tried to change the permissions on the files that the service needs to access.
Changing permissions in the registry editor.
Edited the code so that the onStart function only starts one thread.
I think it is some kind of permission problem but I don´t have much experience dealing with Windows server.
Solution:
It turned out to be two seperate problems. The .NET framwork had to be repaired and I had to remove the try/catch clause that I had when starting the service. For some reason (unknown to me) the try catch block did something that made it impossible to start the service in a windows server 2003 but it ran fine on windows 7.
It would be very interesting to know why this is.
Thanks for all the help.
Gísli
Have you installed the right version of .NET Framework on the Server 2003 PC? What comes as standard on Windows 7 will need to be installed manually on an older OS.
You say "I have tried everything I can think of". Please edit the question to show what you have already tried so we don't suggest something you have already done.
EDIT:
Try also the Fusion Log viewer. Set it to log failures then start your service. Hit refresh then see if any errors are logged. Double-click a line for more details.
I'd guess that you installed the .NET 3.5 service using .NET 2.0? InstallUtil will work since the CLR is the same, but the service won't start because of .NET 3.5 dependencies.
See Also:
How to install a Windows service developed in .NET 3.5?
In your OnStart code you could wrap everything in a try-catch block and write the exception message and stack trace to a file using something like:
File.WriteAllText(#"C:\Temp\MyServiceLog.txt", exp.Message + exp.StackTrace);
This will help you analyze the problem. Also, I'm using a very simple way of debugging my services: I'm wrapping them in a WinForms wrapper if the session is interactive. For that, I need the following:
A form that creates an instance of the service class
New methods DoStart and DoStop in my service class, which are public and call the protected OnStart and OnStop methods
New code in above form's OnLoad and OnClose handlers, so the DoStart and DoStop methods of the service instance are called accordingly
Then I add the following code to the Main method in Program.cs:
if (Environment.UserInteractive)
{
Application.Run(new FormServiceHoster());
}
else
{
// ... old code to create service instance.
}
This way you're making the "service" run as an application when you just hit F5 in Visual Studio or double click the EXE in the Explorer. When the service is actually run as a service, the Forms-code is ignored.
Usually you can debug services by attaching to the process, however, that doesn't work for debugging the start and stop code. This method helps a great deal debugging the service start and stop code.
You will need to add references to System.Windows.Forms and System.Drawing manually.
This is the point where I bet you wish you had used some logging package like log4net, which might help tell how far your program gets.
Is it possible that the code in the OnStart event is actually taking longer than you expect. If so, you could move that code to a thread, so that the OnStart event finishes (and so Windows reckons the service has started) while your thread continues working.
Are you running the service as admin? If so, that usually rules out permissions issues. (If it still goes wrong, it will rule out the KB 886695 issue as that seems to only apply to local system).
Since you are using .NET 4.0 are you sure that either, the full version is installed, rather than the Client Profile, or that your application works with the client profile?