Deploying ASP.Net Web Forms project to Fedora 24
Your code is Full NET and not even NET Core and trying to deploy it to Mono Framework. This may not work, Convert your project into Mono or NET Core and retry.
Accessing ASP.NET Development Server from another pc on the network
I'm making some guesses about your setup here so bear with:
If your virtual machine is XP Professional, Vista Business, Windows 7 Professional or better, then you should be able to run IIS locally on the development machine and access that webserver from another machine which is on the same network via the virtual machine's name.
Likewise, if you're doing development on a real machine and would like to use different virtual machines to access the web application, you should make sure that you have IIS installed, create a new website in IIS and you should be to browse to the web application via machine name from your virtual machines.
Either way, don't try to use the builtin web server from Visual Studio, just publish your site to IIS and work with it that way.
Good luck and hope this helps some.
Create a Linux-based Docker file for .NET Framework project
Finally, after a week of trying, I was able to get an answer.
We have to base the image on Nginx and install the mono on it.
- Create a folder that contains the following:
- Publish your asp project in the
dist
folder. - In the Nginx folder create a folder with the
sites-available
name. - In the sites-available folder create a file with the
default
name and the following codes:
server {
listen 80;
access_log /var/log/nginx/mono-fastcgi.log;
root /var/www/;
server_tokens off;
more_clear_headers Server X-AspNet-Version;
location / {
index index.html index.htm default.aspx Default.aspx;
fastcgi_index /;
fastcgi_pass unix:/var/run/mono-fastcgi.sock;
include /etc/nginx/fastcgi_params;
}
}
- In the Nginx folder create a file with the
fastcgi_params
name and the following codes:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param PATH_INFO "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- In the pools folder create a file with the
sample.webapp
name and the following codes:
<?xml version="1.0" encoding="UTF-8"?>
<apps>
<web-application>
<name>root</name>
<vhost>*</vhost>
<vport>-1</vport>
<vpath>/</vpath>
<path>/var/www/sample-app/</path>
</web-application>
</apps>
supervisord.conf
file:
[supervisord]
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes = 50MB
nodaemon=true
user=root
[program:mono]
command=fastcgi-mono-server4 --appconfigdir=/etc/mono/pools --socket=unix --filename=/var/run/mono-fastcgi.sock --printlog --name=mono
user=root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:nginx]
command=nginx
user=root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
- Finally Dickerfile:
FROM mono:latest
RUN apt-get update \
&& apt-get install -y \
iproute2 supervisor ca-certificates-mono fsharp mono-vbnc nuget \
referenceassemblies-pcl mono-fastcgi-server4 nginx nginx-extras \
&& rm -rf /var/lib/apt/lists/* /tmp/* \
&& echo "daemon off;" | cat - /etc/nginx/nginx.conf > temp && mv temp /etc/nginx/nginx.conf \
&& sed -i -e 's/www-data/root/g' /etc/nginx/nginx.conf
COPY nginx/ /etc/nginx/
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY pools /etc/mono/pools
COPY dist /var/www/sample-app
EXPOSE 80
ENTRYPOINT [ "/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf" ]
VB.NET on Linux
There are a few, like SimpleBasic, GnomeBasic and XBasic. None of them are fully compatible with Visual Basic.
The above answer was accepted eons ago, but is horribly outdated, since more recently, there's also .NET Core. This will run the actual VB.NET language, but it will not use Windows Forms controls and features powering most real VB.NET applications. .NET Core 3 does support some variation of Windows Forms, but only on Windows.
Please check Pedro Polonia's excellent answer that contains all the details that mine misses.
Command dotnet ef not found
To install the dotnet-ef
tool, run the following command:
.NET 7
dotnet tool install --global dotnet-ef
.NET 6
dotnet tool install --global dotnet-ef --version 6.*
.NET 5
dotnet tool install --global dotnet-ef --version 5.*
.NET Core 3
dotnet tool install --global dotnet-ef --version 3.*
For more information about the history of dotnet-ef
, see the announcement for ASP.NET Core 3 Preview 4, which explains that this tool was changed from being built-in to requiring an explicit install:
The dotnet ef tool is no longer part of the .NET Core SDK
This change allows us to ship
dotnet ef
as a regular .NET CLI tool that can be installed as either a global or local tool.
Accessing ASP.NET Development Server from another pc on the network
I'm making some guesses about your setup here so bear with:
If your virtual machine is XP Professional, Vista Business, Windows 7 Professional or better, then you should be able to run IIS locally on the development machine and access that webserver from another machine which is on the same network via the virtual machine's name.
Likewise, if you're doing development on a real machine and would like to use different virtual machines to access the web application, you should make sure that you have IIS installed, create a new website in IIS and you should be to browse to the web application via machine name from your virtual machines.
Either way, don't try to use the builtin web server from Visual Studio, just publish your site to IIS and work with it that way.
Good luck and hope this helps some.
C# code runs quick on IIS, but slow on Mono - how to improve it?
Regexes are a particularly weak area for Mono. Mono's Regex class always uses interpreted code, while .Net can turn it into compiled IL, resulting in much faster execution.
Most other forms of text processing like replaces should be roughly similar.
Related Topics
Getting Selected Value of a Combobox
How to Get Img/Src or A/Hrefs Using HTML Agility Pack
Why Can't I Retrieve an Item from a Hashset Without Enumeration
Auto Create Database Tables from Objects, Entity Framework
Incorrect Syntax Near the Keyword 'User'
ASP.NET MVC 4 + Ninject MVC 3 = No Parameterless Constructor Defined for This Object
Open iOS Application from Unity
C# - How to Prevent Mousewheel-Scrolling in My Combobox
Is There a Tool for Finding Unreferenced Functions (Dead, Obsolete Code) in a C# App
Assemblytitle' Attribute in the .Net Framework
Is Idependencyresolver an Anti-Pattern
How to Pass Variable into SQLcommand Statement and Insert into Database Table
Filesystemwatcher to Watch Unc Path
Is a Finally Block Without a Catch Block a Java Anti-Pattern