Application can't find Local IIS Server - c#

I have client-server .net application, WCF communication with IIS.
During development I encountered a strange phenomenon:
Once in a while, when I run my application without debug and press a button - it seems like the server doesn't respond to the action.
Then I turn to check the same action on debug mode, and when I try to attach the service to process in oder to debug it - I can't find the w3wp.exe process, which is surely active !
But when I open the inetmgr (IIS Manager) and press Browse to the service site - suddenly the service is found in the Attach to process list on VS, and everything continues to work - with or without debug mode - as if nothing had happened.......
Does anyone experienced something similar, or have any assumption why is this happening?
I am concerned that similar incidents can affect the stability of my system.
Note: Perhaps the phenomenon above occurs after I update the client service reference, but I'm not pretty sure.
Thanks!

I'm not exactly if I will answer your question since it's not clear but let me put answer anyway:
I sometimes get an error in running WCF on my machine and this because I have my host running Local IIS then when I change it to IISExpress it runs without issues.
To change this, right click the project -> properties-> open web tab, locate servers and select IIS Express in dropdown. See image
To understand the difference between the two you can check: http://weblogs.asp.net/scottgu/introducing-iis-express

Related

Connection to a basic WebAPI fails

I am trying to test the possibility to convert all my WCF service to WebAPI but so far it's a mess. WCF is easy because you create a default project and add 1 or 2 sample method that return anything then add as a service by using the http address and it works out of the box.
On WebAPI you add connected service and type the address and it throw errors so obviously out of the box it has errors and is missing stuff to actually work.
My question is what is missing to WebAPI made with .NET6 to be able to be connected to ?
Following Microsoft example what i should do is to run the service obviously. Then use the path of the json file generated by swagger and input that in the URL of the connected services, give it a namespace and a classname and your good to go.
Step 1 : Running the service
This works i can call the basic 3 method i made for test purpose that return string, List<string> and List<List<string>> and i can execute the "tryout" button and they output everything that it needs
Step 2 : Copy the json file path provided by Swagger
I assumed that this url is good by default. I can click it and i see the definition which seems good.
Step 3 : Create and empty console app and add the connected service
When adding the connected service i pick OpenAPI as it's the only option anyway.
Then it asks for File or URL that i put my value form the service that is running. In this case this is : https://localhost:44341/swagger/v1/swagger.json. I then choose the namespace of WebTest1 and classname of WebTest2 as i dont care and click next
Step 4 : Configuration progress
This is where i have the error which is where i see that the service that can actually run cannot be connected to
Checking project for required NuGet packges... Downloading service
reference from https://localhost:44341/... ErrorFailed adding service
reference(s). Failed to download metadata file from :
https://localhost:44341/.
I finally figured out the temporary fix. I was also able to copy this project over to a colleague and the issue is the same. The problem lies into Visual Studio defaulting for some reason on the debug option of IIS Express which does properly run the service when you press F5 and your browser open normally and you can test things out. The problem is that when you project runs under IIS (actually configured like it would be the real deal) or IIS Express (the only IIS option in the debug setting) you cannot from another application connect to that service.
However if you switch the debug option to the project name and run your WebApi with that instead it also works as expected from the browser that it open but you now can actually add that service from another application without any error.
Personally i have a third option which is WSL which i "guess" is the linux sub system i can't tell as this crash when i try to start and there is no help for the UI of Visual Studio to help understand these menu options.
Now i still have a problem to attach to one running in a real IIS which is probably linked to the same reason why IIS Express debug doesn't work. So i now know that the base code works and now it's an issue of finding why the default doesn't let other application consume from IIS / IIS Express.
For reference purpose this is the debug menu in question where the IIS Express option is not working but selecting the project name like pointed out on the picture actually works.

Deployment to Remote Machine failed - UWP Debugging

I am currently attempting to deploy an app to a Windows 10 tablet running the Creator's Update, over my local network. When I select remote machine and enter my debug settings, I can discover the tablet on my network, and get its address and Authentication mode automatically.
However, when I try to deploy, I get this error:
DEP6957 : Failed to connect to device using Universal Authentication. Please verify the correct remote authentication mode is specified in the project debug settings. 0x8007274C: The network event being waited on triggered an error.
As far as I can tell from the documentation that I've read, this process should be more or less plug and play since the Creator's Update, can anyone explain what I might be doing wrong, or what might be going wrong?
Listed here are my debug settings currently in use.
Update: Since its not the solution I was looking for, I'm not adding it as an answer, but if anyone comes across this looking for a fix and no one has suggested one, the way I ended up working through this is just downloading the remote debugger to the tablet and running the old method for C# apps. I never did find out why the UWP method didn't work.

System.Diagnostics.Process.Start("Notepad.exe"); is not working on live server

I'm unable to execute the following from a asp.net web application.
System.Diagnostics.Process.Start("Notepad.exe");
The project builds without errors and it works fine locally. On the live server, it just times out. I spent hours researching this online, only to find that there are others that have had the same problem. So far nothing has worked for me. Most replies seem to suggest looking at permissions. Our IT Director isn't sure how to resolve this issue either.
You probably run the web app on IIS Express locally. That means anything like opening Notepad can work, as it runs under your account in your session.
However, running on full IIS is completely a different thing, as revealed in my blog post,
https://blog.lextudio.com/2015/04/web-application-differences-in-visual-studio-and-iis/
Even if Notepad is opened in that way, it is in session 0 on IIS server side, and you cannot see it.
If you attempt to open Notepad in JavaScript at client side, you might also be forbidden to do so, as browsers run client side web apps in sandboxes, which removes access to the operating system resources.
Usually only web apps that explore the security holes in web browsers can launch Notepad by bypassing sandboxing as well as other security protection mechanism, and you probably won't be allowed to do so in a normal web app.

DevFC.exe (Development Fabric) for Windows Azure Crashes

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

Is there any way to get publishing queue in sitecore?

Problem is that I use a 5.2 Sitecore, and when I start to publish something, it only shows the publishing window and a "Queued" message. There is a chance that some people full published several times(that means 15000 items and 4 slaves), and the publishing queue is stuck. The restart of the webserver/app pool is not an option.
Any experiences in sitecore publishing errors?
something like this
If several full publishes are queued then you will have to either wait and see if things finish or recycle the AppPool to start over. Try checking your Sitecore logs to see if there is any information in there that will tell you if publishing is actually locked up or if it is just taking a while to finish.
In my experience it is possible to see that locked up publishing dialog and still have the publishing queue clear itself. Unfortunately though you will most likely have to recycle the AppPool to fix this issue.
So the final "solution" was to be the AppPool restart. Shame that the full publish stuck the sitecore shell, but the db browser could publish. Whatever, think I should contact to some sitecore support guy. BTW thanks Andrew&Kim!
When this happens to me, I normaly wait until the publishing is done. But the problem is that noone knows how long time it will take.
Sometimes a reboot of the server accually does the trick, because the publish then dies. You could try to restart the server (if you have that opportunity of course) and then see if it helps. Otherwise ou have to be patient and wait until the publish queue is empty again.
It is possible to see the publishing queue on sitecorerocks - the visual studio sitecore plugin --> there is a job viewer that shows all the publishing task currently running plus the indexing task
AppPool restart is the way to go if you would like to "kill" the publishing operation.
Open IIS
Expand the main node
Select "Application Pools"
Find and select the worker process that your site uses
On the right hand side hit "Recycle" under "Application Pool Tasks" header
You can also take a look at (your site)/sitecore/admin/PublishQueueStats.aspx, or (your site)/sitecore/admin/jobs.aspx - take a look on a file system, see what other administrative tools available for you in "(your web root)/sitecore/admin" folder. Might find some gems!
Yes, you can see all items in publish queue by using code. There is a way to get the list of item IDs in publish queue using API (Sitecore.Kernel.dll).
IdList publishQueue = Sitecore.Publishing.PublishManager.GetPublishQueue(startDate, ToDate, Context.CurrentDatabase)

Categories