We have a laravel app (Version 5.5*) deployed in WIndows Server 2012 R2. But our development stack is LEMP. Same codebase works fine in development STACK but fails in WINDOWS SERVER.
Problem:
In our App, there is a REPORT DOWNLOAD queueable job which reads data from database table and generates an excel file using box/spout package(version 2.7) depending on user input date range (daily,weekly,monthly, etc) .
When running the queue:work command from cmd as administrator,
$writer->openToFile(‘path/to/file’) throws an error : failed to open stream : no such file or directory.
See this image for code snippet throwing error
Solutions I tried:
Setting right permissions(full control Read & write) for Storage folder of my project (For Users, IIS_IUSRS,IUSR)
Setting right permissions(full control Read & write) for C:windows\Temp folder (For Users, IIS_IUSRS,IUSR)
Created symlink for storage folder inside public
FYI:
OS: windows server 2012 r2
PHP: 7.2*
Laravel: 5.5.*
box/Spout package: 2.7.*
** AT LAST GOT THE SOLUTION AFTER GOING THROUGH ANSWERS OF OTHER QUESTIONS RELATED TO THIS PROBLEM **
You can follow the following procedure:
Go to IIS Manager
Select your desired project (For example: myexampledomain.com) listed under Sites
Go to Security tab and you'll see the users listed with their permissions on the folder.
Now, click Edit button to go to a new window and click Add. In the text box,type IIS AppPool\MyApplicationPoolName.In our example it should be IIS AppPool\myexampledomain.com.
Click Check Name and you'll see the test change with underline.
Click Ok. Add the appropriate permission(Modify,read,write) to the newly created user.
That's it!!!
Thanks to all for responding.
We know a random port number is assigned to a web application in Visual Studio. It works fine in my office desktop. But when I pull the code onto my laptop (from VisualStudio.com) and run the web app. I got a message, saying,
The specified port is in use
Port 10360 is already being used by another application.
Recommendations
Try switching to port other than 10360 and higher than 1024.
Stop the application that is using port 10360.
I can fix it using Recommendation #1 by changing the port into something else like 13333. But I am very curious what happened to port 10360. How can I check what application is using port 10360? How can I stop that application?
I had a similar issue running Visual Studio 2019 on Windows 10.
Some solutions that worked for others seemed to include:
Changing the application port number.
Have Visual studio automatically assign a port number each time the application start.
Restart Visual Studio
Restart the computer.
Unfortunately, none of these solutions worked for me, assigning another port number did work but was not an acceptable solution as it was important for my application to run on a specified port.
The Solution
First I ran the command:
netsh http add iplisten ipaddress=::
from an elevated command-line process. This solved the initial error, when attempting to run the application I no longer got the "port in use" error, instead, I now got an error stating the application was unable to bind to the port because administrative privileges were required. (although I was running Visual Studio as administrator)
The second error was caused by Hyper-V that adds ports to the Port Exclusion Range, the port my application uses was in one of these exclusion ranges.
You can view these ports by running the following command: netsh interface ipv4 show excludedportrange protocol=tcp
To solve this second error:
Disable Hyper-V: Control Panel-> Programs and Features-> Turn Windows features on or off. Untick Hyper-V
Restart the computer.
Add the port you are using to the port exclusion range: netsh int ipv4 add excludedportrange protocol=tcp startport=50403 numberofports=1 store=persistent
Reenable Hyper-V
Restart the computer
From here everything worked perfectly.
i solve the problem this way...
File -> Open -> Web Site...
After that select Local IIS under IIS Express Site
remove the unwanted project.
hope this help.
change it in solution (right Click) -> property -> web tab
Click Create Virtual Directory (in front of project Url textbox)
This was haunting me for over a year!
For me,
no website was running iin IIS Express
nothing was using the port as determined by running: netstat -ano at the command line.
The solution was to run
netsh http add iplisten ipaddress=::
from the command line.
Happy days, and credit to: James Bryant! https://developercommunity.visualstudio.com/content/problem/110767/specified-port-is-in-use.html
SIMPLE SOLUTION THAT WORKED FOR ME: (Credits to combination of other's answers)
**My System Info:**
Windows 10 build : 1809
IIS Version : 10.0.17763.1
Hyper-V : Enabled
Docker : Installed - 2.3.0.2 (45183)
Check for blocked ports range in CMD (admin)
>> netsh interface ipv4 show excludedportrange protocol=tcp
(Sample output):
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
49696 49795 (SEE HERE, 49796 to 49895 is not blocked)
49896 49995
... list goes on ...
Open Visual Studio and Navigate to > Project > Properties > Web > Servers > Project Url
Use the Port that is not blocked.
(Sample port):
http://localhost:49796/
Restart Visual Studio (if required)
Have a coffee and share love. (required) :)
I had the same problem, but no proccess appeared neither in netstat nor in resmon.
What solved the problem for me was closing all the open browser windows.
You're looking for netstat.
Open an administrative command shell and run
netstat -aob
And look for port 10360. It'll show you what executable opened the port and what PID to look up in Task Manager. (Actually, run netstat -? in an unprivileged shell first, because I don't approve of blindly running anything you don't understand, especially in a privileged context.)
Here's what the switches do:
-a shows all connections or open ports, not just active ones - the port you want is probably listening, not active.
-o shows the owning PID of the connection or port, so you can find the process in Task Manager's Processes tab. (You might need to add the PID column in Task Manager. View->Select Columns)
-b shows the binary involved in opening the connection or port. This is the one that requires elevated access.
The cause of this issue in my own case is a bit different. Everything was working fine until I started docker to do some other stuff. Starting docker, in one way or the other, added some new ranges of ports to the Port Exclusion Ranges. What to do:
Open command prompt (As an administrator)
run: netsh interface ipv4 show excludedportrange protocol=tcp (You should see the port your application is using in the excluded port ranges)
run: net stop winnat
run: netsh interface ipv4 show excludedportrange protocol=tcp (by this time, the Administered port exclusions ranges should reduce)
run net start winnat.
If the problem was caused by Windows NAT Driver (winnat), then you should be good by now.
Close the VS
Start again - right click and run as admin
Run your project again.
Running visual studio in administrative mode solved my issue
Delete the .sln file, if you have one.
Open the file C:\Users\NN\Documents\IISExpress\config\applicationhost.config
Locate the problematic site in configuration/system.applicationHost/sites and delete the whole site section.
"Open Web Site.." from Visual Studio and the project will be given a random new port.
For me the "The specified port is in use" error is usually fixed (well actually worked arround) by stopping the "Internet Connection Sharing (ICS)" (SharedAccess) and the "World Wide Web Publishing Service" (W3SVC) service.
After the project / ISS Express is started the stopped services can be started again without issues.
Whenever i receive the error the port (in the 50000 range) is definitely not in use (checked with netstat & tcpview).
It would be nice if Microsoft did some integration testing of Visual Studio / IIS Express along side with HyperV and the "normal" IIS Service OR gave some guidance on which port ranges to use for VS / IIS Express (and which ports to avoid).
Visual studio 2015
Close all the files you have open inside Visual studio.
Then close application and exit Visual Studio.
Open Visual Studio and it should successfully run.
I hope this helps.
netstat didn't show anything already using the port
netstat -ano | findstr <your port number> showed nothing for me. I found out that port was excluded using this command to see what ranges are reserved by something else:
netsh interface ipv4 show excludedportrange protocol=tcp
You can try to unblock the range from the start port for a number of ports (need Command Prompt with Administrator):
netsh int ip delete excludedportrange protocol=tcp numberofports=<number of ports> startport=<start port>
However, in my case I couldn't unblock the range, I just got "Access is denied", so I ended up having to pick another port for my site.
My original solution: The only thing that worked was deleting the .vs folder in the solution folder. (I've since found you can just delete the .vs/config/applicationhost.config instead to avoid losing so many settings).
If netstat doesn't show anything, try a reboot.
For me, nothing appeared in netstat for my port. I tried closing Google Chrome browser windows as #Clangon and #J.T. Taylor suggested, but to no avail.
In the end a system reboot worked, however, so I can only assume that something else was secretly holding the port open. Or perhaps it just took longer than I was prepared to wait for the ports to be released after Chrome shut down.
For me, close all application and restart the computer.
When window start, Open Visual studio first, then open browser and click run(F5).
Now it works. I don't know why.
Open Task Manager and Just Close all processes of 'IIS Express System Tray' and 'IIS Express Worker Process' and Re-run the Project
For me, the Google Chrome browser was the process which was using the port. Even after I closed Chrome, I found that the process still persisted (I allow Chrome to "run in background" so that I can receive desktop notifications). I went into Task Manager, and killed the Chrome browser process, and then started my web application, it worked like a charm.
Open your csproj with for example Notepad ++ and scroll down to DevelopmentServerPort. Change it to something else as long as it's above 1024 like rekommended (so for example 22312). Also change the IISUrl to http://localhost:22312/. Save your changes and restart the project.
In my case there was no application using specified port and elevated running of Visual Studio didn't help either.
What worked for me is to reinstall IIS Express and than restart computer.
For me it was an orphaned VBCSCompiler task from a previous run, that didn't shut down and was somehow interfering. Killing that task solved it.
https://developercommunity.visualstudio.com/content/problem/31482/vbcscompiler-does-not-shut-down.html
You need to configre this parameter by running the following in the administrative command prompt:
netsh http add iplisten ipaddress=::
click on the notification present on bottom of the task bar if you receiving the error like port in use then select the iiss icon right click then click on exit ,it work like charm for me
I had same error showing up. I had my web service set as an application in IIS and I fixed it by:
Right-click on my WebService project inside my solution > Properties > Web > Under 'Servers' change from IIS Express to Local IIS (it will automatically create a Virtual Directory which is what you want)
When Port xxxx is already being used, there's always a PID (Process Id) elaborated with the error. Simply go to the task manager on the machine you are running the application, click on details, and you will identify what the other application is. You can then decide whether you want to end that process or not
Just to add to this, I had the full IIS feature turned on for one of my machines and it seemed to cause this to happen intermittently.
I also got random complaints about needing Admin rights to bind sites after a while, I assume that somehow it was looking at the full IIS config (Which does require admin as it's not a per-user file).
If you are stuck and nothing else is helping (and you don't want to just choose another port) then check you have removed this if it is present.
FWIW, I tried tons of these options and I didn't get anywhere. Then I realized I had installed VMWare Player just before the issue started. I uninstalled it, and this error went away.
I'm sure there's some way to make them coexist, but I don't really need Player so I just removed it. If you've tried all kinds of stuff and it's not working consider looking through any programs you've installed recently (especially those that deal with network adapters?) and see if that gets you anywhere.
In Visual Studio 2017, select Project/Properties and then select the Web option. In the IIS section next to the default project URL click Create Virtual Directory. This solved the problem for me. I think in my case the default project Virtual Directory had been corrupted in some way following a debugging session.
For me only thing worked is removing the element containing my application name, path and binding info under
</system.applicationHost> element in
applicationhost file.
To be found under C:\Users\yourUsername\Documents\IISExpress\config
Closed the the solution , deleted the bad site element , save the applicationhost file and close.
Reopen the application/Website from Visual studio using Admin rights - Rebuilt and Run. Voila... A new port is auto assigned to your application which solves the purpose.
Can also be verified without running-- check the Properties window for the solution and URL will have new port number.
In my case I got also this issue from my ASP Core 3.1 projets.
I thing that for some reason visual studio ignore the IP/Port setting in the project property and start it on 5000 and 5001. I discovered this while attempting to start my Core 3.1 projects from prompt using dotnet run
And this post helped me
How to specify the port an ASP.NET Core application is hosted on?
It suggest to
Specify the port in the appsettings.json or maybe appsettings.development.json. (see lower)
Close Visual Studio
Delete /.vs, /bin, /obj folders
Restart Visual Studio.
appsettings.json / appsettings.development.json content
{
/***************************
"Urls": "http://localhost:49438", <==== HERE
/***************************/
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"connectionStrings": { ... }
}
I cannot start my website from Visual Studio 2010 anymore.
For a few days I cannot start my project in a web browser using F5. When I open my web application directly by typing the same url 'http://localhost/Default.aspx' everthing works fine.
When I run the project (F5) a new webbrowser starts, but after a few seconds it is stuck and Visual Studio gives an error dialog:
Microsoft Visual Studio
Unable to start program 'http://localhost/Default.aspx'.
OK
When I run the project in release mode it gives an extra error:
Microsoft Visual Studio
The following module was built either with optimizations enabled or without debug information:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\6552bec6\694bce32\assembly\dl3\8c9bd8d8\fb1d75cb_af26cc01\[name].Presentation.DLL
To debug this module, change its project build configuration to Debug mode. To suppress this message, disable the 'Warn if no user code on launch' debugger option.
OK
I have already repaired, removed and reinstalled Visual Studio 2010, I've tried using different browsers (including Chrome and Firefox), used different aspnet_regiis.exe options, etc. etc.
Nothing helps, and yeah now I'm stuck pulling hair out of my head ...
Anyone any idea how to solve this?
Does it work if you start it with [CTRL]+[F5] which runs without the debugger?
If so, then you have an issue with the debugger auto-attaching to the web server. I would check that debugging is enabled for your web project - a warning that usually crops up automatically from VS when it detects that a project is not built in Debug mode.
This is not as simple as switching the project configuration over to Release, because the DLL that the debugger is moaning about is one of the dynamically generated ones originated by Asp.Net itself.
Typically you should have, in your web.config:
<configuration>
<system.web>
<compilation debug="true" >
</compilation
<system.web>
<configuration>
(Along with any other stuff in <configuration> and <system.web> nodes).
There's also the possibility that Asp.Net debugging is not, for some reason, enabled.
Check out this msdn article on debugging asp.net applications in VS2010 for more information.
Note that if this is VS010 express, then you won't be able to debug - as confirmed by the aforementioned link; but since you way it used to work then I guess that's not your problem.
Update
Since that hasn't worked - you can try emptying the Temporary ASP.Net files folder. Easiest first is to do an iisreset. Then navigate to C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and delete everything in it. I've had issues in the past where the Asp.Net binaries don't get refreshed and so when I'm debugging it moans that the files are out of date.
Change the View Browser to another browser. Run the view in browser or debug, then change back to original browser should work after that.
Had same problem, answer for me was to remove Avast Free AV. Everything worked for a year with avast free up until a week or so ago, uninstalling it fixed the problem.
I had this exact problem with Visual Studio 2008. The solution was to set the default web browser that VS uses to a real browser (e.g. IE) and not the "Internal Web Browser".
Right click on an ASPX file in your project and select "Browser With...". This lets you select the default browser to use when you select the "View in Browser" option and for when you debug/run the app (this is key).
Select your favourite browser (i.e "Internet Explorer") and click on "Set as Default". Do not pick "Internal Web Browser".
Debug away! Your app should come up in your browser now and debug as normal.
the solutions for me is to test with 127.0.0.1 in place of localhost. and all goes well for.
so the problem come from the host resolution name, to solve it please proceed like :
open cmd and then tape : %systemroot%\System32\drivers\etc\
open hosts file with notepad and the look for localhost ligne(you'll find 0.0.0.0 befor it )
change the 0.0.0.0 with 127.0.0.1 at all lignes with localhost .
I solved in this way:
Right click on a aspx page
Browse with set internal browser as default
Remove the previous default browser
Add %programfiles(x86)%\internet Explorer\iexplore.exe
Set this choice as default
For me I just did a Build /ReBuild on the project level and it started working!!!
I had the same problem. When I debug my code it says:
Unable to start program 'C:\homework.exe'. this system cannot find the file specified."
I'm using Microsoft Visual C++ 2010 Express but when I made a new project by the following steps:
Open C++:
Press new project
Press win32
Press win32 Console Application
Rename it
Click next
make sure: that the application type is console application
additional options: empty project*
Press Ctrl+Shift+A
In Visual C++/Code section press C++ File (.cpp)
rename it and press add
It works fine with for me now.
Please set your page name e.g Default.aspx revert to parent in IIS configuration
I'll share my experience with this same problem. This is not a solution, but someone may be able to figure out the problem from my particular experience.
I've been having this same problem for a few weeks now. (I don't know what changed on my system.) I do not run as local admin, because we are not allowed to have admin privileges on our PCs where I work.
Until today, I could expect F5 (Start Debugging) to start up a new local VS web server, open an IE window, and then issue an "unable to start program http://localhost:nnnn/Login.aspx" and "access is denied" error pop-up. If I closed the IE window, waited a few seconds, and then clicked F5 again, it usually started up my web app in debug mode just fine from that point on.
But today, that all changed. I did not change any configuration on my web app, which has been running fine, but I did add a couple of more classes to one of my subprojects. At this point, I could never get past the "unable to start program" message. I could run my app without debugging, but that was rather pointless. I even tried attaching to a running (non-debug) IE process, but that did not work.
Finally, I modified some of the properties in the WebAppName >Web >Servers screen. Specifically, I enabled "Specific port" for a specific HTTP port (which VS had been using all along), and I disabled "NTLM Authentication". I also enabled "ASP.NET" in the Debuggers section. Some of these I first clicked, then unclicked, then clicked again, saving in between each click.
This time, running with debug (F5) worked.
After running several times, I still usually get a "unable to start" error the first time after a recompile, but I can still usually get a debuggable running app to start after the second or third try. At least I'm back to where I was yesterday.
I suspect it has do with VS reloading its execution profile, and also probably something to do with permissions (since I cannot run as admin).
I'm using VS2012 with an ASP.net app that was written using VS2003... I've tried everything to get the IE page to open automatically when I select F5, or even Ctrl+F5... Haven't been able to get anything to work... However, I have stumbled upon a very poor work-around. When I select debug and I get the 'Unable to start program...' msgbox... I noticed that on the icon-tray I get a msg saying local-host has started
You'll notice a picture that the msgbox is pointing to:
Well, if you right click it, you get three options:
When you select the first: 'Open in Web Browser', it will open IE with the page your working with...
Like I said, it's a very poor work-around... but it works. This isn't an issue when I select debug using 'Chrome' or the page-inspector... But they have their own issues.
Try to turn on Bypass proxy for local addresses.
First you can go to your browser settings-> Change proxy Settings-> Connection-> Lan Setting and just check bypass proxy for local addresses.
If this solution don't work then also copy the following code check your web.config file for settings to bypass firewall:
<system.net>
<defaultProxy>
<proxy usesystemdefault="true" proxyaddress="http://proxy:port" bypassonlocal="false" />
</defaultProxy>
</system.net>
I easily resolved this problem by enabling script debugging in the browser.
When I ran into this problem (using IE 11) I noticed that iexplore was open about a hundred times in the task manager. After killing them all I was able to open my project just fine.
Since then, I have made a .bat file with this code:
taskkill /F /IM iexplore.exe /T
so now I just run the .bat when I get that error.
(alternatively you could run that code from the cmd)
I just ran into this problem in Visual Studio 2013. I had to enable Anonymous Authentication.
Click on the project node in solution explorer.
Hit F4 to show the properties window.
Change the Anonymous Authentication option to Enabled.