For some reason when I run my project locally, everything works just fine. When I publish my site live to my shared hosting server, the actionlink causes links to come out as
http// www.mydomain.com/MySolutionName/Account.aspx/LogOn
when it should be
http// www.mydomain.com/Account.aspx/LogOn
Any ideas?
Check whether you published to a virtual directory named MySolutionName under the root of the web site. If you did, then this is expected behavior.
I thought that this was an option under the Publish screen (or maybe under the Project settings screen). I'm running on my MacBook so I can't confirm. Have you checked there to see?
Can you show some of the ActionLink code that you're talking about...?
(BTW: I have no idea why this site won't let me log back in. I never got an OpenID when I put in my new user info, wtf?)
I publish to a folder on my desktop and then upload via FTP. On my host I set the folder as an application directory since it's a subfolder of my root.
Root
./MySite
./MyOtherSite
Each folder is it's own application directory where I put different sites. There are no virtual directories that I know of. Since I cant see the server config, i can't be sure of that statement.
Related
I have a ASPNET Core application that works fine on my machine with URL https://localhost:5001/, but not on the client's server, where the application's URL is https://example.com/subfolder/.
The problem seems to be an error in a redirect on one of the pages, where a user is sent to /something rather than /subfolder/something. I'm using relative URL's only. In the rest of the application, redirects work fine.
I was wondering if it is possible to debug the application in Visual Studio and have it run in a subfolder, preferably using Kestrel, but IIS Express might be an option too.
Update after comments While adding specifics about the problem, I found out that I was looking at it from the wrong angle. The actual problem seems to be that the application is started as https://example.com/subfolder (no trailing slash). Redirecting to ./something (or just something) will result in https://example.com/something.
(My real question therefore would be: If https://example.com/subfolder is opened, how can I redirect to https://example.com/subfolder/? I'll first try to fix this myself, maybe it should be configured in the webserver. In the meantime, I'd still like to know if subfolders can be used in debugging)
In development, it seems you can't debug your program in subfolder.
I don't recommand you to spend a lot of time to serach how to do that, and I also suggest you use IIS. Because in IIS, it supports Virtual Application, and I think it is you want.
Steps:
create a main website, and create a virtual application.
choose the project folder as Physical Path, mainsite and virtualapplication.
open vs2019 as administrator, maybe you need open it twice,and one for main site and another for virtual application.
then you can attach to a running process on your local machine.
you can start your two webapp in one port, and you can debug them.
After publishing a MVC5 web application of mine to my IIS server (Individual User Accounts), it would seem that the URL is accessed incorrectly.
During debug, it would be e.g http://localhost:1234/api/Account/UserInfo?=XXXXX
The debug works just fine. The only issue kicks in after I've published it via my IIS7 server.
After publishing and using Google Chrome's console, it would appear that the page is requesting for a resource at mydomainname.com/api/Account/UserInfo?=XXXX instead of mydomainname.com/WEBAPPLICATIONNAME/api/Account/UserInfo?=XXXX.
My best guess is to modify the URLs in /Scripts/app/app.datamodel.js but it would just cause more parsing problems.
I've searched around and can't seem to find any related problems. I hope someone here will be able to lend a hand.
Look like you are using relative path like "/api/Account/UserInfo". Instead i'll recommend you to use #Url.Content("/api/Account/UserInfo"). This will solve your problem
Explanation
In local system when we run application in WebDev server it never have sub folder (like WEBAPPLICATIONNAME) therefore you relative path work correctly. but when you host your application in IIS under Default website in another new website /Virtual folder (like 'WEBAPPLICATIONNAME') then "/api/Account/UserInfo" fall back to Default Website because for '/' in starting. #Url.Content or #Url.Action make sure to add virtual directory name, hence changing your path to "/WEBAPPLICATIONNAME/api/Account/UserInfo" in IIS.
I need my local (testing) deployment to respond to a URL like
http://localhost/apps.mydomain.com/myappname
not
http://localhost/myappname
Long story as to why but I just need that to be the case.
I actually had this working for awhile but I can't remember how. I had to delete and add the site again and now can't figure out what combination of settings gave me the result.
How can I achieve that URL structure locally?
MORE INFO: I've created a website called "apps.mydomain.com". I then added an application under that site with the alias "myappname". This app can be invoked with URL
http://localhost/myappname
Why? What happened to "apps.mydomain.com"? When I add it...
http://localhost/apps.mydomain.com/myappname
I get a 404.
You can just create directories apps.mydomain.com and apps.mydomain.com\myappname under C:\inetpub\wwwroot.
Or, if you don't want to publish your application in wwwroot, you can create virtual directory in IIS.
I am struggling with trying to publish a site.
I have made a basic web site with ASP.NET MVC and I now want to host it on a pc.
I have opened ISI manager and added a new site. I set the default directly to the directly where the files for the site are stored but when i navigate to the pc I don't get my site. I get an IIS server error in application error.
What steps do i need to do to get the a basic site to run on the server.
First, you need to have installed iis, this is done you have to register the asp.net framework, for this you need to run a command line.
Go to cmd and type:
aspnet_regiis -i
Done so please enter
http:// localhost/AplicationName
If you get an error, then you should really post that error with your question. However, since the most common problem in the scenario you describe is permissions, I'm going to assume that that is your problem.
Unless you're going to put your code in a directory owned by IIS (such as "inetpub"), then you need to give the IIS user or group rights to the directory your code is in. You can do this by right-clicking the directory in Windows Explorer, and choosing "Properties". Then click the "Security" tab. Use the "Edit..." button to add the IIS user or group. It should be named something along the lines of "IIS_*". You'll need to grant full control, so just like any other publicly available directory (including "inetpub"), you should ensure that there's nothing secure or compromising in that directory.
We are developing an ASP.NET MVC web app that will be hosted on Windows Azure. We have deployed the application a few times during development without any problems. It was actually quite surprising how smooth the process went. Then, when we went to deploy the app for beta testing we kept getting 403 Access Denied errors whenever we tried to navigate to the base url of the site. If we tried to navigate to any of the various Controllers and Actions of the site thereafter we would get 404 The resource could not be found errors.
The other strange thing that we noticed is that we had defined the authentication redirect page to be /Access/SignIn rather than the default Account/Login. Everything worked fine on the development machine and we were redirected to /Access/SignIn but when publishing to Azure we saw we were being redirected to /Account/Login. This made us think there was an issue with the web.config file.
We enabled remote desktop on the Azure deployment and took a look at the web.config file only to find out that it was almost completely empty! The only setting in there was the machineKey. We manually copied the web.config from one of our development machines up to the Azure virtual machine instance and everything started to work from there on.
What in the world would make the deployment wipe out the web.config file? And how can we prevent this from happening as we aren't going to be able to update the web.config file manually every time we deploy an update?
I often solve these sorts of problems by looking at the contents of the .cspkg file. This allows me to avoid waiting for the Azure package upload and initialization. Here are the steps to view the .cspkg contents:
Navigate to the /bin//app.publish folder
Rename the .cspkg file to .cspkg.zip.
Open .cspkg.zip. You will find a .cssx file (which is really a zip file) for each project referenced by the Azure project.
Extract the .cssx file you wich to inspect and rename it to .cssx.zip
Open the .cssx.zip and look around. For WorkerRoles, check out the approot folder. For WebRoles, check out the sitesroot folder.