Starting application in monodevelop vs xsp4 - asp.net

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

Related

Xamarin iOS, FileNotFound for Bundle Resources

I keep getting the error like this:
Error System.IO.FileNotFoundException: /Users/Nathaniel/Library/Caches/Xamarin/mtbs/builds/EagleEyePrism.iOS/7b66664107c017167463bbde19c6a2f4/obj/iPhone/Debug/optimized/upload_blue.png does not exist
File name: '/Users/Nathaniel/Library/Caches/Xamarin/mtbs/builds/EagleEyePrism.iOS/7b66664107c017167463bbde19c6a2f4/obj/iPhone/Debug/optimized/upload_blue.png'
at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-08/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) [0x0002d] in <cd319828b05749ae9de0c80034a6d2bc>:0
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () [0x000b6] in <cd319828b05749ae9de0c80034a6d2bc>:0 EagleEyePrism.iOS
It doesn't matter what file it is. If I remove upload_blue.png, it throws an error on the next Resource.
I have tried everything. I have deleted the Xamarin cache on the Mac, I've deleted AppData\Local\Xamarin on the PC, it simply will not compile.
If I set all the BundleResources to Embedded Resources, it will compile and run, but then none of my image collateral gets displayed.
I've scoured the internet for hours trying to solve this problem.
I'm running the latest XCode on the Mac, with MacOS Mojave, and Windows 10 with Visual Studio 2019 on the PC.
I solved it by disabling the Optimize PNG images option in the iOS Build Options

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

Running XSP4 in MonoDevelop 2.6

After a fresh install of Ubuntu 11.10, which comes with Mono 2.10, I've found myself in a bit of a pickle: I can't run ASP.Net 4.0 projects, even though I have XSP4 installed. It's almost as if it expects there to only be an xsp2...
Here's the error:
Could not launch web server. The "xsp2" web server cannot be started. Please ensure that it is installed.
Details:
MonoDevelop.Core.UserException: The "xsp2" web server cannot be started. Please ensure that it is installed.
at MonoDevelop.AspNet.AspNetExecutionHandler.GetXspPath (MonoDevelop.AspNet.AspNetExecutionCommand cmd) [0x00000] in <filename unknown>:0
at MonoDevelop.AspNet.AspNetExecutionHandler.Execute (MonoDevelop.Core.Execution.ExecutionCommand command, IConsole console) [0x00000] in <filename unknown>:0
at MonoDevelop.Core.Execution.DefaultExecutionHandler.Execute (MonoDevelop.Core.Execution.ExecutionCommand command, IConsole console) [0x00000] in <filename unknown>:0
at MonoDevelop.AspNet.AspNetAppProject.DoExecute (IProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, MonoDevelop.Projects.ConfigurationSelector config) [0x00000] in <filename unknown>:0
Any idea what the problem for this could be? Is XSP4 only compatible with MonoDevelop 2.8?
Assuming you are using monodevelop, Go to Project menu select your "application option" not solution option.In the dialog box that appears, under "Build" select "General", then on the right pane change "Runtime Version" to Mono/.Net 4.0
VB.NET addin seems no to support .NET 4.0 (see this stackoverflow question) but I found that just creating a symbolic link (xsp2->xsp4) was enough to run Mono/.Net 3.5 on mono-xsp4

error ASPPARSE: Could not load type

If I run this command on my system
<Exec Command="C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler -v localhost -p $(SourceDir)\wwwroot -u -f projectCompileCode\project -c -errorstack -nologo" />
I get the following error:
error ASPParse: Could not load the type: Projectname:SomeFile.
The project is web application project
This my stack trace:
[HttpException]: Could not load type 'ProjectName.FileName'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCa
e, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeN
me, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDicti
nary parseData)
[HttpParseException]: Could not load type ''ProjectName.FileName.
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virt
alPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseReader(StreamReader reader, VirtualP
th virtualPath)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPat
virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType(
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(
uildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResu
t(Boolean isPrecompiledApp)
at System.Web.Compilation.BuildManager.CompileGlobalAsax()
at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath
tartingVirtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath starting
irtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCa
lback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag
rCallback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManag
rCallback callback)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client
uildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(Client
uildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
If I build in v2.0.50727 then still it is giving the same error.
My application is built in with VS 2010, .net frame asp.net frame work 4
Any help is greatly apperciated.
Have you tried:
Checking references
Doing a clean and a build
Checking the Inherits attr in the HTML against the code behind
Creating a new App Pool in IIS for this web site?
I see a similar problem. Works locally from within VS2008, but once published and deployed to the server, I get the same error as described here.
None of the suggestions I have provided worked for me; maybe they will work for you.
I had the same error. When I opened the web site DLL in ILDASM, the Type for a control was completely missing, as if it didn't even get compiled.
As it turns out, the codebehind files got excluded from the project. This is strange considering that the builds on my machine were successful! At any rate, I carefully re-included codebehind files and it all started working.
This often happens because the project file (.csproj or .vbproj) does not contain the necessary references to the files in question. Try cleaning/rebuilding all projects and making sure that the latest project files are moved to the server as well.
Another possibility is that the file was not actually included in your project at all. This allows the builds in Visual Studio to run just fine, but will break when compiling the .NET code (with aspnet_compiler for example) because all .aspx/.ascx/etc. files within the specified folder are compiled - whether they are included in your project or not.

Resources