Trying to install asp.net on xampp - asp.net

im trying to run aspx files on my xampp installation But the Apache Server doesn't Start.
What i did:
Installed a clean Xampp.
Installted the mod_aspdotnet-2.2.0.2006-setup-r2.msi
changed my httpd.conf:
#asp.net
LoadModule aspdotnet_module modules/mod_aspdotnet.so
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
<IfModule mod_aspdotnet.cpp>
AspNetMount /SampleASP "C:\xamppASP\htdocs"
Alias /SampleASP "C:\xamppASP\htdocs"
<Directory "C:\xamppASP\htdocs">
Options FollowSymlinks ExecCGI
Order allow,deny
Allow from all
DirectoryIndex index.htm index.aspx
</Directory>
AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
</IfModule>
#asp.net
After this steps the Server doesn't start anymore.
Even if i just run:
LoadModule aspdotnet_module modules/mod_aspdotnet.so
The Server doesn't start.
I already checked the Folder C:\xamppASP\apache\modules
The file exists.
What am i doing wrong?

Im pretty sure that this:
AspNetMount /SampleASP "C:\xamppASP\htdocs"
Alias /SampleASP "C:\xamppASP\htdocs"
<Directory "C:\xamppASP\htdocs">
Should be:
AspNetMount /SampleASP "C:\xamppASP\SampleASP"
Alias /SampleASP "C:\xamppASP\SampleASP"
<Directory "C:\xamppASP\SampleASP">
That is, that you change your directory name to the one you give as 'SampleASP'.

The reason it won't start anymore is probably because the directory you set doesn't exist.
"C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles"
I have been trying to get the same thing to work and I found that I don't have ASP.NETClientFiles, if you remove your changes it will start again.
Or if you figure out where ASP.NETClientFIles comes from and install that. Then it will work.

Related

How to set Symfony3 environment in Apache

I am running Apache 2.4 on my development machine so I can test code locally. How do I tell Symfony 3.4 to use the 'dev' environment instead of the 'prod' environment?
I've tried browsing to http://localhost/app_dev.php but that just redirects to http://localhost/. It looks like the front controller is set in .htaccess but if I modify that file, then my production server will be using the wrong front controller.
I've read the docs on the following pages and it talks about how to create new environments but not how to set the default environment.
https://symfony.com/doc/3.4/configuration/environments.html
https://symfony.com/doc/3.4/setup/web_server_configuration.html
I'm running Apache 2.4 on Windows 10 and here is my vhost configuration
<VirtualHost *:80>
ServerName example.local
DocumentRoot "C:\Users\kento\PhpstormProjects\example\web"
<Directory "C:\Users\kento\PhpstormProjects\example\web">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
DirectoryIndex app_dev.php
</Directory>
ErrorLog "logs/example-error.log"
CustomLog "logs/example-access.log" common
</VirtualHost>
example.local points to 127.0.0.1 in my hosts file. I set DirectoryIndex to app_dev.php but that seems to be overridden by the .htaccess file.
You've already set the vhost to use app_dev.php, but then you allow a .htaccess to override with the AllowOverride All. Change that to AllowOverride None and the .htaccess will be ignored.
There may be some config from there you would be able to merge into the vhost.
I tend to prefer all the configuration in the virtual host, and not have any use of a .htaccess file, for a small speed boost - especially in production.

images and css not displaying in Symfony on Xampp Server

I have downloaded the Symfony project and added the database.
But when I am going to web folder then on the home page. Images and CSS not displaying.
It is showing like below,
http://localhost/uploads/logos/image.jpg
** but my project is on a folder name like /folder/ **
All the images and css have broken links.
How did you run the web server? Try this,
Symfony v2.* = php app/console s:r
Symfony v3.* = php bin/console s:r
If you want to Xampp Server, you should change the root directory;
project_directory/web
In this matter virtual host is the best solution.
<VirtualHost *:80>
ServerName project.local
ServerAlias www.project.local
DocumentRoot "C:\xampp\htdocs\project\web"
<Directory "C:\xampp\htdocs\project\web">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Allow from All
</Directory>
</VirtualHost>

how to move Symfony project to an other folder?

I have started a project on Symfony2 and now I would like to change the place where I installed it in my files.
here where it is now:
Application/MAMP/htdocs/symfony/
What is I move the symfony file to
user/myWebSiteProject/...
by the way my composer is in:
user/myWebsitePorject/bin/composer/composer.phar
---------------------------------------------/path/composer.json
Can I do it just like it... move it just like any folder. or should I take into account some things...?
You can move the whole folder without any major issues. What you will need to do is to change any VirtualHosts you may have setup, You will need to update the DocumentRoot property.
You would normally find the file to update on a mac at: /etc/apache2/extra/httpd-vhosts.conf depending on how your system is configured.
I'm presuming that your using Apache, Your VirtualHost should look something like this:
<VirtualHost *:80>
ServerName local.symfony
DocumentRoot "/user/myWebSiteProject/web"
<Directory "/user/myWebSiteProject/web">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog "/private/var/log/apache2/local.symfony-error_log"
CustomLog "/private/var/log/apache2/local.symfony-access_log" common
</VirtualHost>
This guide should help with the configuration.

Setting up ModMono With Apache2

I ended up attempting to setup ASP with ModMono on Apache2, via following this guide.
It's not working, however: when I click a .aspx file, I end up just downloading it on my localhost.
Here's my asp.webapp file /etc/mono-server2
<apps>
<web-application>
<name>asp</asp>
<vpath>/asp</vpath>
<path>/var/www/asp/</path>
<vhost>127.0.0.1</vhost>
</web-application>
</apps>
and my asp file in /etc/apache2/sites-available/
<Virtualhost 127.0.1.1:80>
ServerName asp
DocumentRoot /var/www/asp/
<Directory /var/www/asp/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow, deny
Allow from all
SetHandler mono
DirectoryIndex index.aspx index.html
</Directory>
</VirtualHost>
Is there anything which I'm doing wrong here? The only issue I can think of is that I'm trying to reference a directory, rather than a specific page or file.
If you have installed mod_mono and it is configured correctly to work with apache2 then all you will need to do is change your site configuration in /etc/apache2/sites-available/ to something like this:
<Virtualhost 127.0.1.1:80>
ServerName asp
DirectoryIndex index.html index.aspx
DocumentRoot /var/www/asp/
AddMonoApplications asp "/:/var/www/asp"
MonoServerPath asp "/usr/bin/mod-mono-server2"
<Directory /var/www/asp/>
MonoSetServerAlias asp
SetHandler mono
AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
<FilesMatch "\.(gif|jp?g|png|css|ico|xsl|wmv|zip)$">
SetHandler None
</FilesMatch>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow, deny
Allow from all
SetHandler mono
DirectoryIndex index.aspx
</Directory>

is there a version of apache mod_aspdotnet for asp.net 4.0?

or an alternative solution for running asp.net 4.0 in apache that doesnt require to install mono which isnt compatible with everything we use?
Set the configuration file for Apache as follows:
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" \
"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
AspNetVersion v4.0.30319
AspNetMount /ASP "C:/ASP"
Alias /ASP "C:/ASP"
<Directory "C:/ASP">
Options FollowSymlinks Indexes
AspNet files
Order allow,deny
Allow from all
DirectoryIndex index.html index.aspx default.htm default.aspx
</Directory>

Resources