last day (15 days later) » 

10:42 PM
0
Q: How to get a .NET app to run on IIS 10.x when lives in the same folder as the Main Wordpress app?

Peter The Angular DudeOK, this is my first foray into .NET. I have a project where I've deployed the app to my dedicated server on 1and1.com I can publish from VS2015 from my local box I've set up the site as an Application on IIS In the bindings, since this is NOT a domain, I've had to use a sub domain: something...

 
I really doubt they can co-exist in the same folder. I doubt the routing engines of each will be able to cope. And directly requesting the .cshtml file in the URL is not how MVC works. You'll probably need to deploy it in a sub-folder. I've no idea if your specific host supports running .NET and PHP in the same account. Is it Windows hosting? Or you're using .NET Core on Linux? And why MUST they be in the same folder, exactly? It's the URL paths which ought to be important, not the location of the files. P.S. Any reason you didn't just integrate this with the Wordpress app using PHP??
 
It's a windows platform and IIS uses PHP Manager and runs MYSQL as well. It's working great. I do have a solution whereby the <.net> app LIVES in a sub folder of the WordPress App. I also copied a version of the .NET app outside the WordPress Folder in wwwroot. So, what I have is a COPY of the WP app and .NET that I received from the client. They apparently didn't say where each lives. Yes, I agree, the location doesn't matter... I believe that "it 'IS' integrated on the actual app.... but I'm not well versed in .NET... when I punch up the URL, I get the errors above.
 
From where did you get the ASP.NET MVC application? You have to learn the MVC framework docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started‌​/… The actual URL pattern is different from intuition, and .cshtml is forbidden for reasons.
 
"I believe that "it 'IS' integrated on the actual app" ...no I meant by just coding the app in PHP (maybe even as a Wordpress extension) instead of using another language and framework alongside it. I guess you mean integrated in the sense that one has hyperlinks to the other, in which case it really doesn't matter where you deploy it as long as the other app can be configured so that the root of the hyperlinks points to the right place (and as long as the two don't interfere with each other of course).
But anyway like I said, you don't access an MVC app by going to the .cshtml view. You have to use the URL of an Action Method defined in one of your controllers. If you took a basic MVC tutorial (such as the one provided by Microsoft) this should have become clear hopefully.
What precisely that URL looks like depends on the routing config in your MVC startup code, but if you left it as default then if you have a Controller "HomeController" with an action method "Index" which does not accept any input parameters then http://www.example.com/Home/Index would take you there (assuming your app is deployed at the root folder of the domain). What specific view is rendered by that action is irrelevant (it can even be told to make a choice at runtime depending on some rules in the code), it's the action route which you use which is important.
In your case if the action method happens to have the same name as your cshtml view file then your URL might be something like http://www.example.com/account/login, but there's no guarantee of that. Check the name of the action in your controller and build your URL accordingly.
 
ADyson, LOL - you are 100% Correct...and I'm going to look in the Home Controller for what you stated. Thank you. Your statement "no I meant by just coding the app in PHP (maybe even as a Wordpress extension) instead of using another language and framework alongside it." is interesting as I didn't think of that. So, here's the actual URL: semble.webparity.net/semble/index.php and if you open the DEV console you'll see the 197 error for 404 MISSING... but you'll see the URL resolve to LOCALHOST. I added Better Search Replace plugin to replace all instances of LocalHost with the URL
ADyson, this: example.com/account/login is Also 100% correct. in my case, semble.webparity.net/semble/index.php should point to the _AppStart.cshtml so I don't NEED the index.php. I'm trying to get the site up with just the subdomain as this is a STAGING and DEV server I'm using it on. I simply have to mimic semble.com. I have all the code... semble.com is WORDPRESS site but when you click LOGIN, it goes to .NET and then to Piranha CMS on the same DOMAIN. This is what I'm trying to mimic I have both databases (WP and PIRANHA). The actual domain and sub are on 2 dif. servers.
 
10:42 PM
90% of the stuff at that index.php link fails because it's trying to load from localhost. You clearly have some config wrong in the Wordpress DB somewhere pointing to the wrong hostname.
" in my case, semble.webparity.net/semble/index.php should point to the _AppStart.cshtml" ...not sure what you mean here. Are you saying you want this URL to simply redirect to your new .NET login page? You can do that with IIS redirect rules. And again, you don't ever link or redirect to the .cshtml directly, you refer to an action method's route instead.
P.S. visiting semble.webparity.net/semble/account/login currently throws some kind of server-side error, which you'll have to look in the server's logs to get the cause of (it doesn't display the full error to me, and rightly so!)
 
Let me check and get back to you.
Forgive me but where would I find the logs... ? Don't mean to sound illiterate....
It's a windows 2012 R2 SERVER on 1and1.com dedicated
Here? %SystemRoot%\system32\logfiles
ADyson, that folder shows sub folders and all those recent file are hexidecimal....ARGH!
 
ASP.NET will log exceptions to the Windows Event Log by default (which is viewed in the Windows Event Viewer GUI application normally), unless your hosting environment has got some alternative configured (and/or you added other custom logging functionality to your application). Hopefully the hosting provider can direct you to the right place if you don't have access to Event Viewer. It may be described in their standard documentation, or exposed through whatever control panel they provide for the account, or failing that you can ask them how to find it.
Of course if you have a dedicated VM then you should just be able to log onto it via Remote Desktop and open the Event Viewer
 
I have complete control... this is not a VM but a real server, which is great... it's dedicated... I'll look in the event viewer and get back to you. Thanks, ADyson
See UPDATE everyone...
 
VM or physical server actually it's irrelevant here. In a modern hosting company I'd be very very surprised if they really gave you a physical machine to rent, almost everyone uses virtualisation as it's far more flexible and efficient. If you don't you're probably out of business pretty quick these days. As the end user you're unlikely to notice the difference in terms of how you access your "machine" - connecting via Remote Desktop onto a Windows O/S is the same process whether that O/S is running on a bare metal or a virtualised host, you only interact with the O/S not the underlying stuff)
This error can be caused by a virtual directory not being configured as an application in IIS would seem to be the salient point from your error message. Check your IIS setup.
 
See UPDATE 2 with image of FOLDER STRUCTURE in IIS
 
10:42 PM
I would expect that you need to convert the folder to an application, not add a new one - if you add a new one it's likely to create it one level down in the structure. I'd expect the defaults are ok if you've got a fairly standard MVC app, unless you have some specific reason you know you need to change them (e.g. authentication method or something). You can check the IIS docs to see what they all do. N.B. if you have the .NET and PHP code in the same folder I have no idea what effect converting it to an Application will have on the PHP, if any.
 
ADyson, I've moved the .NET app into it's own folder in the structure of wwwroot in IIS. As I found out, the two apps live on different AWS servers which explains a great deal. I wish I could have you jump on and see but I cannot give out emails here... there's no way to ping me because I'm running out of time. So, this is the link that a friend at MSFT gave me: stackoverflow.com/questions/16307112/… and I've looked at that solution. SEE UPDATE for the authentication section in both the TOP LEVEL and the .NET app.
 

last day (15 days later) »