EADDRINUSE address already in use - asp.net

When I run dnu . kestrel to start up the asp.net 5 server on OS X, and then press CTL+C to stop the server, then run dnu . kestrel a second time, I receive the following exception:
Sullys-MacBook-Pro:Test1App Sully$ dnx . kestrel
System.Exception: Error -48 EADDRINUSE address already in use
at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.Check (Int32 statusCode) [0x00000] in :0
at Microsoft.AspNet.Server.Kestrel.Networking.Libuv.listen (Microsoft.AspNet.Server.Kestrel.Networking.UvStreamHandle handle, Int32 backlog, Microsoft.AspNet.Server.Kestrel.Networking.uv_connection_cb cb) [0x00000] in :0
at Microsoft.AspNet.Server.Kestrel.Networking.UvStreamHandle.Listen (Int32 backlog, System.Action`4 callback, System.Object state) [0x00000] in :0
^C
The terminal acts like the server is running, because I have to press CTL+C again to terminate the server process. While it is "running", I can't actually navigate to it from a browser.
Is there a proper way to shut down the server as I change code, without having to kill the terminal, open a new one, navigate to my project directory and re-start kestrel?
I have seen other errors related to this on SO; they all seemed related to Android. I haven't seen anything related to kestrel and the dnu for EADDRINUSE

On OS X pressing the Enter key in the terminal should stop kestrel. What is happening is that Cntrl-C puts it into a suspended state and you would then have to find the process and issues a unix kill command for that process. The issue https://github.com/aspnet/KestrelHttpServer/issues/26 refers. Though I am sure I say a thread saying it was going to fixed so that either Cntrl-C or Cntrl-Z would would work on all environments for Kestrel

I know this is a OSX question, but I was getting this exception in Windows after I changed --server.urls=http://*:9000 to --server.urls=http://*:9000;https://*:9000 to attempt to support https. It look like the semi-colon is not supported.
The same is true in RC2 with .UseUrls("http://:9000", "https://:9000")

Related

Local git server (Bonobo git server) trying to clone a repository throw me an error

On my machine, the git client version is 2.11.1.windows.1
and the server is Bonobo Git Server 5.2.0.0
In the command prompt commands show me this error "/info/rafs not valid: is this a git repository" after trying to clone a repository.
I went to the official site in the question section and find this
fatal: http: /info/refs not valid: is this a git repository?
This is a git client way of saying that it didn’t receive git stream as a response from a server. That usually means, that there has been an error on the server side.
To determine what type of error it is, view the log file located at App_Data/Bonobo.Git.Server.Errors.log.
Inside the errors.log.txt file i see the error:
w3wp.exe Error: 0 : Error occured and caught in Global.asax - System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.Substring(Int32 startIndex, Int32 length)
at Bonobo.Git.Server.MvcApplication.Application_AcquireRequestState(Object sender, EventArgs e)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This type of error, also reported in jakubgarfield/Bonobo-Git-Server issue 657, is supposed not to happen with Bonobo 6.x, released later in 2017 (6.0, 6.1 or 6.2, all in 2017). There is no 6.3 or 6.4.
You would need to check if the issue persists with any Bonobo 6.X, including the 6.5 (April 2019).

"aspnet_compiler.exe" exited with code 1, tried all the other posts with the same title

Project:
ASP.NET 4.5.2
MVC 5
Visual Studio 2015 (latest)
When building the project, today it mysteriously began erroring out with the error in the title. Now, it is not the build which is failing, but the publish:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
Now, I have gone into the temp build folder, at
[path to project]\obj\Release\AspnetCompileMerge\Source
And it seems to have all the files needed to push to the sandbox, but when I do so attempting to reach the site errors out with a massive message (50+ lines). Will append once I have them formatted.
Suggestions?
NOTE: Other projects still compile just fine. This is limited to this project, specifically.
NOTE 2: I have seen several requests to use aspnet_compiler.exe with the -errorstack flag in the commandline, but I have yet to figure out what the -v and -p flags mean, so I am currently unable to provide the output. I have never used the commandline for development before, so details would be appreciated.
UPDATE 1: I actually figured out the command, and this is what I got:
D:\[path to project]>aspnet_compiler.exe -errorstack -v /[project] -p D:\[path to project]\
Microsoft (R) ASP.NET Compilation Tool version 4.0.30319.33440
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
D:\[path to project]\web.config(43): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
[ConfigurationErrorsException]: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (D:\[path to project]\web.config line 43)
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_Compilation()
at MTConfigUtil.GetCompilationConfig(String vpath)
at System.Web.Compilation.BuildManager.IsBatchEnabledForDirectory(VirtualPath virtualDir)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback callback, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
In particular, note:
This error can be caused by a virtual directory not being configured as an application in IIS. (D:\[path to project]\web.config line 43)
Problem is, the only thing in my Web.Config at that line is
<authentication mode="None" />
You see, because the IIS built into VS 2015 crashes every time I stop debugging, I set up IIS on Windows itself and just pointed it toward my project directory. But it was working just fine up until now. Could this be the issue?
EDIT 2: Commenting out line 43 in my Web.Config now throws this:
This error can be caused by a virtual directory not being configured as an application in IIS. (D:\[path to project]\web.config line 46)
Clearly there is something very, very strange. Considering I have published at least twice since I last changed my Web.Config.
Ended up doing a backup of the project, nuking it from orbit, repaving with a new blank project, adding back in all the required NuGet packages and then copying over from the backup all the files I had directly edited. Including all the Migrations files also helped, as it meant I could pick up with the DB right where I left off. The only thing I had to walk through with a fine-toothed comb was the Web.Config -- I wanted to make sure this was set up perfectly, so I hand-edited it like a surgeon doing brain surgery.
FYI, I coped everything over through the file system while the project was unloaded, and then “included into the project” anything I had previously created from scratch.
Not the ideal situation, but hey. This project is still under construction, so I lost just about an hour or two at the most doing the rebuild. The tough part was dumping my Team Services repository, as it wouldn’t accept the new project. I did this after I confirmed the new setup was working 100%, as I wasn’t too concerned about not being able to roll back beyond a certain date.
After refactoring a solution I had a file containing a commented out class, so it only had the using clauses and namespace set. It was using a namespace that was no longer in use by any files but may have been cached somehow so didn't immediately error.
Building didn't pick it up and it caused the aspnet_compiler exited with code 1 error plus a few other unrelated errors that weren't errors. Removing the empty class file fixed it. Also remove any old namespaces from Views/web.config.

Dealing with "HTTP request timed out. Exiting." when building a large aspnet project for Docker

I have a multi-project aspnet solution using MVC6
The Solution file is split into three projects
sln
+---- Model
+---- API
+---- Web
The Docker file lives in the same folder as the SLN file and has the following content
FROM microsoft/aspnet
COPY . /app
WORKDIR /app/Web
RUN ["dnu", "restore"]
EXPOSE 5004
ENTRYPOINT ["dnx", ".", "kestrel" ]
The issue when I run docker build -t myapp . from the powershell command line is the build process begins to time out.
PS C:\www\MyApp> docker build -t myapp .
Sending build context to Docker daemon 19.11 MB
Step 0 : FROM microsoft/aspnet
---> 0835b01cd4f8
Step 1 : COPY . /app
---> Using cache
---> 56c449a3d847
Step 2 : WORKDIR /app/Web
---> Using cache
---> 8f43b8786452
Step 3 : RUN dnu restore
---> Running in d43e0c4b42c8
Microsoft .NET Development Utility Mono-x64-1.0.0-beta7-15532
GET https://api.nuget.org/v3/index.json
OK https://api.nuget.org/v3/index.json 555ms
Restoring packages for /app/Web/project.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.diagnostics/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.mvc/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.mvc.taghelpers/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.server.iis/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.server.weblistener/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.staticfiles/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.tooling.razor/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.configuration.json/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.logging/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.logging.console/index.json
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.visualstudio.web.browserlink.loader/index.json
OK https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.diagnostics/index.json 6436ms
[... AFTER HUNDREDS OF LINES OF INITIAL SUCCESS ...]
disaster strikes!
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.win32.registry/4.0.0-beta-23109/microsoft.win32.registry.4.0.0-beta-23109.nupkg
Warning: FindPackagesById: Microsoft.Framework.Runtime.Roslyn.Common
HTTP request timed out. Retrying.
GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.io.filesystem/index.json
Warning: FindPackagesById: Microsoft.Framework.Runtime.Roslyn.Abstractions
HTTP request timed out. Retrying.
GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.resources.resourcemanager/index.json
Warning: FindPackagesById: System.Threading.Tasks.Parallel
HTTP request timed out. Retrying.
GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.diagnostics.debug/index.json
Warning: FindPackagesById: Microsoft.AspNet.Antiforgery
HTTP request timed out. Retrying.
[ ... RESULTING IN MANY LINES OF ... ]
GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.win32.primitives/index.json
Error: DownloadPackageAsync: https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.http.abstractions/1.0.0-beta6/microsoft.aspnet.http.abstractions.1.0.0-beta6.nupkg
HTTP request timed out. Exiting.
----------
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0
at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00000] in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
[ ... AND EVENTUALLY ... ]
----------
Restore failed
A task was canceled.
NuGet Config files used:
/root/.config/NuGet/NuGet.Config
Feeds used:
https://az320820.vo.msecnd.net/v3-flatcontainer/
GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.security.cryptography.x509certificates/index.json
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
The command 'dnu restore' returned a non-zero code: 1
I've tried hunting about for answers on this and doing things like restarting the docker machine or deleting and rebuilding it (in kitematic), but even if those solutions DID work (they don't) that solution seems less than ideal.
Note that I've also attempted to view the urls that are timing out, from the very same machine that is timing out and they do work from windows.
I assume that may mean that the virtualbox docker machine is perhaps timing out, saturating the number of connections it can open or something
The docker image is the default boot2docker linux instance that comes with the docker toolbox.
It is running on windows 10.
Alternatively, if I run the same setup and commands on a new aspnet project (as created using the yo aspnet generator), docker does indeed successfully build the project.
Any help in figuring out how to build a docker image would be very much appreciated.

Not able to deploy ASP .net vnext application on VM on Azure using Docker

I'm trying to deploy asp .net 5 sample application on Azure VM (ubuntu). I'm using Docker tools for Visual Studio 15.
I'm following http://www.hanselman.com/blog/PublishingAnASPNET5AppToDockerOnLinuxWithVisualStudio.aspx
Process 1;
I have followed below steps;
1. Created sample app using VS15
2. Publish wizard, created new VM
3. Published, keeping same host and container port 80.
4. Exposed 80 port using azure portal
Publish goes through but when opened in IE, it shows page can not be displayed.
I have even created multiple VMs and tried the same but no success.
Process 2;
I'm trying to create an image using docker client but it gives TLS error.
Are you trying to connect to a TLS enabled daemon without TLS?
I'm getting this even on my Laptop. which is trying to create the image using 127.0.0.1:2375
Can anyone please help?
I have checked container logs; below is the details.
System.InvalidOperationException: Failed to resolve the following
dependencies for target framework 'DNX,Version=v4.5.1':
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)'
Version: 1.0.0-beta7-15532
Type: Mono
Architecture: x64
OS Name: Linux
at Microsoft.Dnx.ApplicationHost.Program.Main (System.String[] args) [0x00000]
in <filename unknown>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] i
n <filename unknown>:0
at Microsoft.Dnx.Runtime.Commo`enter code here`n.EntryPointExecutor.Execute (System.Reflection.
Assembly assembly, System.Strenter code hereing[] args, IServiceProvider serviceProvider) [0x00
000] in :0
at Microsoft.Dnx.Host.Bootstrapper.RunAsync (System.Collections.Generic.List`1
args, IRuntimeEnvironment env, System.Runtime.Versioning.FrameworkName targetFr
amework) [0x00000] in :0
Husain,
Could you please try the below mentioned two links. Please let me know if you are still facing issues. I will join you in hunting the issue down.
https://weblogs.asp.net/scottgu/announcing-windows-server-2016-containers-preview
https://channel9.msdn.com/Series/Docker-for-NET-Developers/Deploy-your-ASPNET-5-App-to-a-Docker-Container-in-five-minutes

Starting application in monodevelop vs xsp4

I build an ASP.Net WebApi project with mono in Linux.
When I start (Debug/Release) the Application within Monodevelop. The application runs without errors.
Example : I start a (Debug/Release) session. Then I navigate to 127.0.0.1:9000/api/person/ . Then I receive the expected xml output.
However, when I execute the xsp4 server from within the "bin" directory. The application starts fine, but when I go to 127.0.0.1:9000/api/person/ .
I'm ending with the following exception:
Description: HTTP 404.The resource you are looking for (or one of its dependencies)
could have been removed, had its name changed, or is temporarily unavailable. Please
review the following URL and make sure that it is spelled correctly.
Details: Requested URL: /api/person/
Exception stack trace:
at System.Web.StaticFileHandler.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.DefaultHttpHandler.BeginProcessRequest (System.Web.HttpContext context, System.AsyncCallback callback, System.Object state) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+ <Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
Im using :
Monodevelop 4.1.7
Mono: 3.2.7
Ubuntu 13.10
xsp4: same version as monodevelop is using.
bin: location of the compiled binaries of the project build with monodevelop.
Question:
What steps do i miss, which monodevelop automates?
How to get an advanced output(Browser or console) to identify the missing file?
Why is the file missing in the standalone xsp4 and not in monodevelop?
In addition: I didn't noticed this problem until i tried to deploy the app to appharbor.
xsp4 is supposed to be run from the web application directory, not from bin directory.
The reason is in the ASP.NET architecture: a web application consist of a main directory ( say webapp) and several standard directories.
Let's just focus on bin, which only contains compiled assemblies referenced by your web application.
Simply said, if you run xsp4 under the scope of the bin directory, it'll never be able to reference Index.aspx. On the other hand, running Index.aspx from webapp allows the server to load any required assembly from the bin directory

Resources