When web.config is created server gives 500 server error - wordpress

I'm new to web hosting. I have IIS 7.5 server and some WordPress sites are installed on this. and they use pretty URLs with them and has rewrite rules in web.config file.
I tried to setup a new WordPress site and when site is created on IIS it does not seems to be having a web.config file inside the site root. So I manually created a one, and when it is created site gives 500 internal server error (even with blank web.config).
When web.config is removed home page gets loaded. What am I doing wrong?

The web.config is only really needed for URL re-writing.
Because you created a new site, the WordPress code that detects and generates the web.config file has not yet run.
To trigger it, login to admin dashboard, go to permalinks and just click save. This will generate the web.config file.

web.config file contains some configuration information....This file will be generated after seeting up dll's(In case of plugin configuration)..once we hit the url for the first time it will be generated in domain home...
So if you place a blank file...it doesn't have any information..so you're getting 500 error.

Related

Classic ASP GoDaddy Plesk How to bind my domain name with login.asp

I do not know how to launch my website at GoDaddy using Plesk. I have uploaded my files to all root directory. At IIS Settings,I have added login.asp to the default documents and move up the order.
Now when I click Preview
I get the following site and Default.aspx loads
If I add login.asp at the back of the URL, my login.asp page loads Ignore the error
But if I click on Open at Plesk, I get error
Now how to I bind www.mydomain.com to login.asp?
Called the support and they will fix it.

moving website to new hosting causes "forbidden"

I am moving website from one hosting server to another hosting server. I have uploaded files. I am using forms authentification. Basically, I am moving to GoDaddy.
I can access login form directly: www.mysite.com/login.aspx
However, when I open www.mysite.com it shows
Forbidden
You do not have permission to access this document.
What can cause this problem? Which files do not have permissions? Should I modify web.config or anything else?
I am using asp.net version 3.5.
Problem:
IIS has configuration for default document, which is typically default.htm, default.aspx, etc. but not login.aspx. If site has no default document in the root folder and directory browsing feature is disabled you will get the Forbidden message.
Solution:
Either create default document as per default IIS configuration
or change IIS configuration to make login.aspx your default document
To create default document, add a new file, name it as default.htm and copy to the root directory of your site
<html>
<head>
<meta http-equiv="REFRESH" content="0;url=login.aspx">
</head>
<body></body>
</html>
To change IIS configuration, go to your hosting settings panel and find Web Server Settings feature where you could add login.aspx to the list of default documents for your account.
Sounds to me that the default page in IIS is not set. It appears that your default page is Login and the IIS default is Default.
It may be because the IIS is not finding a default start page. Adding default document in IIS is one way. But an other way is adding default document (start page) in web.config file.
Suppose if you want to open login.aspx page when some one opens your website, then add following code in web.config file
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
Think about the basics of how your web server works.
You have one file root folder (typically named www/ or public_html/ or something else depending on your setup) and you have sub folders and files within the root folder.
Web servers work so that they only allow public access to your "public root folder" and not your server files / language specific folders / system folders etc.
And now think about your error message for a second, it tells you that "You do not have permission to access this document." Which is basically talking about either your default.aspx or index.html or some other form of default/index file which loads when you load your root domain.
This is due to "permission error" on that particular file / dependent files etc, exactly as the error message states. You need to check the access mode of your files and folders, which in unix is done by chmod command, and in windows located in file/folder properties -> security -> Permissions which usually lists within a group of users, ie your public/all user group (if it exists)
You need these settings to give read or execute (exec depending on what type of file it is, if html/aspx than read is sufficient, strictly not write in any case as that allows modification to your files by the public) permissions in order for the web server to serve them to public successfully.
In order to give system specific help, your ASP.NET version is not enough to solve it, your IIS info is also needed as well as your server and file system setup etc
Asp.net is probably not registered on your new server. You can check it my adding an simple html file to your folder and try to browse it. As .net is not registered, the aspx extension is unknown.
You should run aspnet_regiis.exe -ir :
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -ir
%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -ir

How to block access to directory listing and certain pages in asp.net?

I have several issues with how I am configuring my web.config due to my inexperience.
I want to set a page, login.aspx, as my default page. If the user logs in successfully, he will be redirected to a page in a protected folder /Protect/Edit.aspx . All users can still access a page in root folder named Show.aspx, will be redirected to login.aspx if they try to click or write the path to Edit.aspx, and I am unsure on how to do this.
My other problem is that if I write just localhost it shows me the directory listing, and I want to avoid this, but setting
still gives me the directory listing. What am I doing wrong?
You need to implement forms authentification for your app. Here is a tutorial
Seems like you don't have a default.aspx page, so IIS couldn't find any document to load first. You can either configure IIS to use Show.aspx as a default page, or just add default .aspx.

Forcing custom 404 pages for pages in URL Routing

Coding Platform ASP.NET 4.0 WebForms on IIS7.5
If I request a page blahblah.aspx which does not exist, I get navigated to my custom error page for Page not found Exception. I have implemented URL routing and so I have omitted all my .aspx extensions for routes.
Now, If I type www.mysite.com/blahblah (thats a url without extension) instead of going to my custom error page, it gets redirected to my IIS 404 error page.
What should I do to make my custom error page appear on my site instead of IIS error page?
The Easy Way
If your IIS 7 web server doesn't already have it, install the IIS 7.0 Administration Pack from Microsoft.
Navigate to the root web server name in IIS, and open the Configuration Editor (part of the Administration Pack). Change the dropdown to system.webServer/httpErrors, right-click on defaultPath, and choose 'defaultPath' Attribute -> Unlock Attribute.
Then try to change the custom error handler page again. Navigate to your site, open Error Pages under the IIS group, click Edit Feature Settings on the right, select Custom error pages and finally, put in your path for the default page.
No lock error this time.
I originally tried to unlock this attribute at the web site level but was prevented, so be aware you may have to go all the way to the root of the IIS tree, the web server itself.
The Manual Way
I know you can accomplish all this by direct editing in notepad of the appropriate config file on the web server. And that may be required for your particular web hosting environment or company production web server change protocols. But why make it complicated if it doesn't need to be? Plus, this way you can do it in the GUI, and compare the before and after to see what changes you truly have to make. But if you MUST do it manually, then:
Open the file %windir%\System32\inetsrv\config\applicationHost.config in Notepad. Run Notepad as administrator if you're having problems.
Pro tip: Do not use notepad++ to edit applicationHost.config. You'll end up secretly and silently saving a 32-bit copy of the file that's in a different folder than the one IIS looks in (due to Windows, not np++) without actually affecting the file you wish to change.
You'll see something like this:
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
Remove the ,defaultPath section and save.
You will be able to make the changes you need.
Assuming you haven't done this already...
Go to IIS, select your website, and choose the option "Error Pages". In there, find the 404 status code, right click and go to "Edit Feature Settings". you can then select "Custom Error pages" and change the "Path Type" to URL "Execute URL" to do some rewriting, or a default redirect page for anything else. Put in your URL as a relative value, and now it should redirect to this url on 404 errors.
Edit: Did a bit of digging, in cases, this config may be locked, if you run the following command, it should remove the lock:
%windir%\System32\inetsrv\appcmd unlock config -section:system.webserver/httperrors
Once that is done, you can edit the url properly.

Problem adding a .asmx file to a custom subfolder within a DNN site in IIS7

I'm trying to add some web service (.asmx) functionality to a DNN 5.6 website.
I've added this using some code behind (which I've placed in /App_Code) and a .asmx file which I'd like to place in a new roor folder - /Services/MyService.asmx
This functionality works fine locally under cassini.
However, when I deploy to IIS7, then I get a 404 for the .asmx file.
Here are some of the experiments I've done:
If I move the file to the /DesktopModules/MyService.asmx then everything works fine - I can see the .asmx file and I can call the service functions without any problems.
If I turn directory browsing on inside IIS7, then I can browse to /Services and see the .asmx file - but when I click through to that .asmx file then I get 404.
If I add a gif file to /Services then I can see this without any problems
Has anyone got any suggestions about what might be causing this? I'm wondering if it's the friendly name code within DNN somehow picking this .asmx file up?
Yes, the friendly URL provider isn't going to allow that in DNN 5.6. In 5.6.2, there will be a setting to let you exclude URLs from the friendly URL provider, to let you get around this issue.

Resources