WebClient.UploadString() fails with - c#

I have an old .Net console application that is running as a job on a sever. One part of it is that it uploads / creates files on another server via System.Net.WebClient. Sometimes I need to run this console manually on my machine. This consolse applicatin was always working fine for me and it still runs fine on the server and also runs fine for all of my coworkers. However, it stopped working for me yesterday:
English translation for the error message is "This property is not supported by this class." Unfortunately there is no inner exception. So this is the only information I get from the debugger.
So I'm sure I did not change anything in the code (I also rolled back from source controll to make sure). I know that it is working for my coworkers. So there must be something wrong with my computer I assume.
I can still access the ftp target directory manually, so access problems are not the problem.
However the only change that I made yesterday was installing PowerShell 6 via the existing PowerShell:
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
But honestly: I'm not sure if this is the culprit (One of my coworkers also has installed PowerShell 6)
Uninstalling PowerShell 6 temporarily also did not help.
I already searched the internet for this problem, but it seems as if I'm the only one and I'm running out of ideas what I can do to fix this.
Does anyone of you have an idea what else could be done?

Related

C# Smart-client deployment is not working?

I haven't deployed a smart-client in a very long time, so I may be doing something wrong. My publish works well, and the app works for me (could be cached?), but my users can't run the app and instead get this error:
Can't reach this page
Make sure the web address XXXXX is correct
Also, when I browse the page from the server, IE briefly starts like the app is going to run, but then nothing ever comes up. The default document is set correctly.
The app works perfectly locally, so I am sure it is an IIS setup issue.
I am just not sure where to go with this. Can anyone offer a suggestion for troubleshooting steps?
The problem is that my organization (actually, the parent organization over my organization) had decided to block the port I was using. After I convinced them to open the port, all worked as expected.

IIS Express 'The specified port is in use' Visual Studio 2015

Apologies about the long message, but I thought I should let you know what I have already tried.
I've very recently started learning C# through Visual Studio and all was going OK until about three weeks ago. I clicked on the button with a green triangle which did the usual thing of launching the internet page, but the site never loads. I then noticed there was an ISS Express notification which brings up the following (can't figure out how to get my cropped screen shot on here):
'The Specified port is in use
Port 49665 is already being used by process "svchost.exe" (process ID "2112")
Recommendations
Try switching to port other than "49665" and higher than 1024
Stop the application that is using port "49665"'
I have managed to locate the svchost.exe on my computer and it is in the system 32 folder. There doesn't appear to be an option to stop it, and I am worried deleting it will break my operating system (I did click delete to see what happens and got an error saying I need permission from trusted installer to do this, but didn't go any further). When I open task manager and look through all tasks, including 'background tasks' and 'windows processes' and can't see it anywhere
I have tried to follow the advice in this discussion:
IIS Express Web Server Port Is In Use
But I cannot fully understand where the solution was- I don't think I have anything called ISS installed, however there is a Local ISS when I go to 'file', 'open website', which I found through the following:
Why and how to fix? IIS Express "The specified port is in use"
I did as the answer marked 21 (with the green tick) suggested and restarted my computer (as one of the comments suggested) however my problem persists. There is no longer anything under 'IIS Express Sites'
I have closed all browsers then tried, restarted and then tried, still no luck
The third answer (7) I really don’t know how to do this (I don’t know what solution they are referring to), so if this is a potential solution I’d be happy for further instructions
The answer marked with a 5 about netstat -aob helped me locate a task called ‘service host: local service (network restricted) (6)’. Trying to terminate this task brings up an error saying that by terminating this task Windows will become unusable- so I assume this is why I couldn’t delete the above. The final part of this answer about elevated access I don’t know what this means or how I would do this.
Closing visual studio and restarting as an administrator doesn’t fix the problem.
I only have Edge and Internet Explorer and I have ended these via task manager whenever I have tried to resolve this problem, but it persists
I tried the answer at the bottom, but was not able to locate the folder IISExpress, maybe this is part of the problem?
Any suggestions where I might be going wrong with the above, or any further advice on how to progress some of the things above, or any new ideas will be welcome.
Thanks for the suggestion Methodman. After much digging I found the solution you suggested here (change the port): How can i change IIS Express port for a site
The answer provided provides excellent instructions with a step by step guide on how to change the port
Just changed the port number until I got one that worked :)
Ed
It is an old post but just in case someone having the same issue recently; I tried many things including removing websites, running VS in administration mode. Nothing worked. Then I finally changed the port which finally worked. Right Click on project. Go to Web on the left menu. And change the port number at the end of the project url to whatever you want. I changed it to 50645.

Run c# code on client side or make a web session interactive?

I'm making an application on c# for signing PDFs. Its works perfectly on my visual studio web project, but when I publish it on my test server it throws me this Error
In this case I'm trying to execute the code that sign a pdf on the server and the error occurs specifically on the line:
System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature()
It is supposed to throws a window on your desktop asking for your certificate (reading a smart Card) and then asking for your PIN just like this
Windows Security Window but I have the hunch that it's not possible because Its implies that the server have to have the possibility to interact with the client's desktop
Ok, now that I've explained all the enviroment that I'm facing, here are the solutions I've tried until now:
1) Trying to correct the Server Error above: I went in the server to IIS>application Pool>MyPage>Advanced Settings>Process Model>Load User Profile and selected True instead of False (Didn't Work)
2) Still trying to correct the Server Error I Went to Computer Management>Services and Application>Services and turned on the service "Interactive Service Detection" (Still not working and doesn't work even if I do the same on the client computer)
3)Finally, I guess that it's not possible to run the code on the server because the Error line above is a native calling of Windows Security so I thought: what if I try to run the code right from the client?. Like a c# applet equivalent or something, well... there are two ways for do that: ActiveX (old technology) and Silverlight (newer). The thing is that I just can't make a simple Silverlight program start on chrome, it does on firefox and IE but if doesn't work on chrome is a totally waste so my last option is to make it run with an ActiveX, and there is almost none useful information in the internet about that
If someone can tell me what to do, either to correct the error or to make my program run from the client side, I would be so grateful
You can't call the system's api from a Web client as this would break the sandbox. If you must use that system call, create a wrapper on the server that will handle the popup, although this would be a very "hacky" solution. You should really be asking why I am trying to use a Web client interface if I must use said native system call.

DNS error when trying to connect to Windows Azure Service Bus

The remote name could not be resolved:
'x.servicebus.windows.net'.TrackingId:bbfe86f8-b5d3
Doing an nslookup works fine.
I can hit the url from the browser with no issues.
Usually rebooting resolves the issue. It seems to be the consistent thing, but sometimes even this doesn't work. Sometimes simply waiting until later fixes the issue.
I've tried closing IIS express, resetting my ip, closing visual studio, etc., but nothing immediately resolves it, other than rebooting, but like I said this doesn't always work, so not sure it's even related.
I've tried disabling my firewall. I uninstalled norton anti-virus, but no luck. I've also disabled Windows Defender.
This only seems to be happen on my Windows 8.1 machine. Even when I'm
experiencing the error, I can run the same code from my Windows 7
machine with no problems. I don't use my Windows 7 machine enough
though to know if it is really a Windows 8 specific issue.
Microsoft mentions possibly using Shared Access Signatures as an alternative for connecting to the service bus, but I'm not looking to rewrite my code over what appears to be a possible bug in Microsoft's SDK. Does anyone know how to diagnose this? I am wondering if there are trace logs that can be setup in web.config specifically for the servicebus perhaps that might give me some additional error information. Or if someone else has run into this and can provide some insight.
This does not seem anything specific to the Service Bus APIs, you can get more information on the IP configuration and reset it on you Windows 8.1 box as follows:
Open an administrator command prompt and type the following:
netsh int ip reset
netsh winsock reset
Check if any errors are listed? If not, go ahead and reboot the computer.
This ended up being a server issue on Microsoft's end which is why it was impossible to resolve through code and machine changes. It took awhile for them to get it figured out and resolved. If anyone has a similar issue they may want want to consider this possibility as well and get in touch with Microsoft.

ClickOnce deployed application asks to install update even if there exists none

I have ClickOnce deployed application coded in C#. I wonder if anyone experienced the same problem.
Clickonce deployed application checks for updates always before execution. One of my clients using this application informs me about an update which the application asks to install even if there exists no update we had deployed. My clients installed the update. But what was installed is the same version. At this point, I wonder why a clickonce application decides if there is an update deployed. I believe this is a weird problem that I could not figure out why it happened.
Is there anyone who knows why such a weird thing could happen ? I suspect may be some of files of the installation removed, thus leading a reinstallation of the program. But I am not sure.
We've had this problem before with some of our clients. The problem ended up being due to object caching on their proxy server. Basically, the client actually is running an old version, so when they start your program, ClickOnce correctly reports that there is an update available. The problem is that the client's proxy server caches an old copy of your program, so when the updater runs the proxy server intercepts the update request and instead sends back a cached copy of your program in place of the update. ClickOnce doesn't notice until its next startup that the "updated" program still isn't actually updated.
The solution is to get in touch with your client's IT staff and try to figure out where the caching is happening and have them clear the cache. It's probably on their custom-built proxy server, but webfilters like Barracuda do object caching too, and so do some of the fancier Cisco routers.

Categories

Resources