How to resolve %DNX_PATH% in development environment? - asp.net

I have a partially developed ASP.NET 5 application. The application has the following three sub projects:
Web
Web.API
Auth.Server
The Web project relies on the Auth.Server for the OAuth implementation and redirects to that project on load. There's some configuration related to the httpPlatform handler in the Web project's web.config.
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
This throws a Bad Gateway error related to the httpPlatformHandler when I run or view in browser the Web project from VS2015. However I've tried publishing the site locally and hosting in IIS with httpPlatformHandler (version 1.2) installed on IIS which actually works.
I could see that this creates an approot folder with a web.cmd file that has %DNX_PATH% variable defined and that the web.config in wwwroot refers this particular approot/web.cmd file for the processPath attribute.
Question: What location should I point the processPath in the development environment?
I'm new to ASP.NET 5 and only have some basic reading under my belt.

Related

How to set up IIS6 to host ASP .NET 4 MVC4 application

I'm having a hard time configuring my server to host MVC4 application. Here's my situation:
I have Windows 2003 server SP2
Until now, all my hosted applications are targeted to .NET Framework 3.5, thus using ASP .NET 2. I use single web site to host web application
Now, I want to host very first application targeted to ASP .NET 4
What I did is:
I've installed .NET Framework 4
I've added new new application pool
I've added new virtual directory to my web site (the same web site that hosts ASP .NET 2 web apps) and converted it to web application. Next, I've selected ASP .NET version 4 on ASP .NET tab
So, I thought that it would be enough. But when I access my application with root url, the first thing I get is 403. I've checked security options and they seem to be all right.
Next, I tried to access one of my controller actions, eg:
http://servername/home/index
and now I get 404 error. Ok, so I've enabled browsing of files and I tried to access web.config, for to check what happens, and I received error:
Could not load file or assembly 'System.Core, Version=2.0.5.0,
Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or
one of its dependencies. The given assembly name or codebase was
invalid. (Exception from HRESULT: 0x80131047)
I've also run regiis command:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -s W3SVC/2049612577/root/cip-new/
but still in vain. Bottom line, it's something wrong, but I have not idea what is happening.
EDIT 1:
I've made some testing. What I did, is I'd created a basic MVC4 application from Basic template and simply published it to the server. And it worked. However when I published it to the server to the same directory, I got the error:
The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047).]
2 things I've had to do in the past to get v4 working on IIS6...
Make sure the site using .Net version 4.x runs in it's own app pool, separate to sites using .Net version 2.x
If you are using Razor I've noticed that IIS6 doesn't immediately know what to do. So you need to configure the Application Extensions Mappings. Add an extension mapping for .cshtml or .vbhtml depending on whether using C# or VB. I think that's why you're getting your 404 errors.
Restart IIS or recycle relevant app pools once above applied if you can to make sure changes are in effect.

Deploying a asp.net mvc4 application to godaddy

I created an ASP.NET MVC4 application using C# on Visual Studio 2012. But facing a hard time deploying it. I uploaded all the folders of my project onto my server (godaddy). But still cant view my website running.
My question: Is this enough to deploy my site ? Or anything else needed?
You can bin deploy an MVC4 app to GoDaddy.
Just copy the relevant MVC4 related DLLs that you need to your production bin directory.
Alternatively, you can set "Copy Local" equal to "true" in the Properties window for any of your MVC4 related project references as described in this blog post. Then when you do a Publish of your application, all of the needed assemblies will be included automatically.
You probably won't need all of these, but in an MVC4 app I currently manage on GoDaddy, I needed to manually include the correct versions of DLLs for:
System.Web.Abstractions.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Optimization.dll
System.Web.Razor.dll
System.Web.Routing.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll
sure, you can deploy your MVC 4 application. Godaddy supports MVC 4.
What I have done to deploy my MVC 4 application is:
1. I included DLLs such as:
System.Web.Mvc
System.Web.Routing
System.Web.Abstractions
2. I edited web.config file. I put next strings:
<system.web>
<trust level="Medium"/>
.....
</system.web>
3. Then I used the File System publish method and then I used FileZilla to transfer the files to the GoDaddy. I copied all files to httpdocs directory. You must copy just to *httpdocs directory.*
That's all. Good luck.

How do I deploy MVC3 Hello World App to localhost and configure IIS

I am having some trouble deploying my MVC3 application to my localhost. I am looking for details to build and deploy a ASP MVC 3 application to my local system. I've tried to deploy this, but have run into problem after problem. Instead of tracking each problem down separately (and I may have to do this anyways) I would like to create a one stop guide for myself and others that see this post.
I'm looking for steps including libraries to install (ASP MVC3, IIS, etc) on a Win7 SP1 machine with VS2010 installed. Also how do I set up IIS, and how do I publish? The goal will be to deploy this web app to another Win7 machine in the house, but localhost will be the first step. In addition, it would be helpful to know whatever steps are necessary to make the website accessible from another machine on the same network.
Here is what I have done so far:
Created an ASP MVC 3 application with VS2010
Built and Run
Installed IIS
In IIS - "Added Application" on "Default Web Site" with the Alias: "Hello"
4a. "Hello" runs on the DefaultAppPool, .Net 4.0; Integrated Pipeline
4b. "Hello" has the physical path C:\inetpub\Hello
In VS2010 - right clicked the project and selected "Publish", using FTP
web browser: navigate to "localhost/Hello"
500.19 - Internal Server error:
Config Error: This configuration section cannot be used at this path. This happens when
the section is locked at a parent level. Locking is either by default
(overrideModeDefault="Deny"), or set explicitly by a location tag with
overrideMode="Deny" or the legacy allowOverride="false"
Config File:
\\?\C:\inetpub\wwwroot\web.config
Requested URL:
http://localhost:80/Hello
Physical Path:
C:\inetpub\Hello
Config Source:
68: <validation validateIntegratedModeConfiguration="false" />
69: <modules runAllManagedModulesForAllRequests="true" />
70: </system.webServer>
Download and install ASP MVC 3
Create an MVC3 Hello World App in Visual Studio
Install IIS from the “Windows Features” / “Turn Windows features on or off” in Windows.
Next, you need to configure a website in IIS. I created one on port 81. Open IIS Manager, and “Add a Website” to the “Sites” node.
For this website, I created this on D:\WebSite, and configured it to run on DefaultAppPool, configured for .NET 4.0, on port 81.
Most of the time, IIS is installed after installing the .NET Framework, so you’ll need to run some commands to register ASP.NET on IIS.
start cmd.exe as an administrator and run aspnet_regiis -i in C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Initially, I had some trouble publishing the project to the destination but for whatever reason, Publish method: “FTP” to Target Location “D:\WebSite” seems to work quite well and publish only the minimum required files.
traditionally you could only deploy to your server using ftp. Though it doesn't make a lot of sense to ftp to a server which runs locally. However Microsoft recently introduce the Web Deployment Tool which works really well. Once you install them then you have the option of creating a deployable package
In Publish dialog, choose option Filesystem instead of FTP, and give it path you have set in IIS

Hosting WCF web services on IIS - works in VS, but not in IIS

I'm very new in web programming stuff, so my question is about basics. I'm developing a SilverLight application and need to access the database from it. I'm using LINQ to SQL to get data from database and a WFC web service to deliver it to my app.
Everything is working fine when I'm running my app within Visual Studio. When trying to publish the web service to IIS - the web service call fails.
To make my question simple, I will focus on a brand new web service. Here the steps I'm doing:
Start Visual Studio 2008 -> File -> New -> Project -> Web -> WCF Service Application
Project Name: MyWcfService
Resulting Visual Studio generates a sample project with implemented Web Service "Service1"
Rebuild, start from Visual Studio (host on ASP.NET Development server)
--> Everything works fine, I see my service under http://localhost:52489/Service1.svc link
Now I want to host this service on my IIS (I've IIS7 on Vista x86 PC)
Visual Studio -> right click Project -> Publish -> target location -> Create new web app named "MyWcfService" -> Publish
Just to be sure check my C:\inetpub\wwwroot\ folder - now it contains the "MyWcfService" subdirectory with all required files.
Open IE on my PC http://localhost/MyWcfService/Service1.svc
The result is:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If > the page is a script, add a handler. If the file should be downloaded, add a MIME map.
I were trying to remove "identity" section from web.config - same problem. Switching off the firewall does not help either.
Can anyone help me? What I'm doing wrong? Maybe I am missing something?
Per Nicholas Allen, Program Manager WCF/WWF,Silverlight # Microsoft:
What registration in IIS is responsible for processing SVC files?
There are two parts to the registration. One part is related to ASP.NET and the other part is related to WCF. The ASP.NET part is that the ASP.NET ISAPI has to be a service extension for IIS. The WCF part is that the HTTP handler has to be a managed handler.
The commands for setting up the two parts are "aspnet_regiis –i –enable" from the 2.0 framework tools and "ServiceModelReg.exe -r" from the 3.0 framework tools.
This results in a managed handler "System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and an ISAPI module "%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" for *.svc files in IIS. In the IIS handler mappings, the managed handler has to be above the ISAPI module for this to work.
Together, the two parts start an HTTP pipeline and pass the resulting requests into WCF.
IIS will only direct requests to ASP .NET for certain files like aspx by default. I'm guessing that you don't have the svc extension mapped to asp .net. Try looking at this http://msdn.microsoft.com/en-us/library/bb515343.aspx.
Silverlight can only call web sevices in the exact same domain as the application (where the xap file lives)
To call a different domain you need to have a clientaccesspolicy.xml file where the web service lives. It's possible this is your problem.
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from>
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
You might not have ASP.Net setup properly in IIS. Take a look at this article:
http://msdn.microsoft.com/en-us/library/aa964620.aspx

Issues within an ASP.NET 2.0 Web Application to Look for When Running on Linux with Mono

My IT department and I are trying to get an ASP.NET web application to run on a Linux with Mono. We have been working on this for about a month to no avail. The Mono setup on the Linux server seems to be good. We are able to run the demo ASP.NET pages on the server and they work fine.
I developed my ASP.NET web application with Visual Studio 2008, and I recently downgraded the application to ASP.NET 2.0. Originally it was in ASP.NET 3.5, which might be the problem. After publishing the web app, I received the following files: Default.aspx, Web.config, bin (with a .dll and a .pdb file), and an empty App_Data file. So far, the error that keeps occuring is an appication error on the server.
For a simple test, I made a simple ASP.NET web app that had a label and a button. We tried that app and it did not work either. Does anyone know of things that I should look for within my ASP.NET web application that would inhibit the application to work?
Application error:
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. this tag should then have its "mode" attribute set to "Off".
!--web.COnfig Configuration File--
configuration
system.web
customErros mode+"Off"/
/system.web
/configuration
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.
!--Web.Config Configuration File--
configuration
system.web
customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/
/system.web
/configuration
Thank you,
DFM
Just for a resolution, I finally figured out what the problem was. The ASP.NET web app has an onload event that enables the web app to read an Access Db. For testing purposes, I did not update the ADO.NET Db path for the web app to read the Db so every time it was loaded through Mono, the generalized error in question would occur. After deleting the onload event, the web app functioned perfectly. Additionally, I had to downgrade the web app to ASP.NET 2.0, instead of 3.5, and delete the LINQ namespaces, which were not being used.
All I have to do is change the path(s) to point to the App_Data folder and place the Db in the folder, as well.

Resources