Sign in with
Sign up | Sign in
Your question

Windows hosting issues

Tags:
  • Programming
  • Apps
Last response: in Apps General Discussion
Share
December 18, 2012 2:22:01 PM

Hello people, I typically work with Linux hosting and PHP, but was asked to move an ASP-based site. So I set up a Windows hosting account, copied over all the files from FTP and pointed the domains to our hosting. Now, visiting the site just displays a directory listing. I've enabled URL rewriting in the web hosting control panel, but no effect.

More about : windows hosting issues

a b L Programming
December 18, 2012 4:08:43 PM

Are you using IIS to host it? There is a "Default page" setting which you should set to your main page.
m
0
l
December 18, 2012 6:29:39 PM

I'm honestly not sure. This hosting has an option for .htaccess (Linux-style) URL rewriting, which I tried, but no effect. I assumed Windows hosting would support IIS as default? I think you're right that the default page is the problem, but I don't know what to set it as. I have no index.anything in the root, just three files. I think one was called General.asax (or maybe Global.asax), then web.config and something else .config.

The bit in the web hosting control panel where I set it just has a large text area where you add filenames in order of priority to search for as the default page. No paths though. The site does contain an Index.aspx, but it's not in the root.
m
0
l
Related resources
a b L Programming
December 18, 2012 6:35:09 PM

Yes, the web hosting control panel place with priority list is what I meant. You should add the name of the file that you want as front page in Default Page list and make it the highest priority. It should work.
m
0
l
December 18, 2012 6:57:39 PM

That's what I mean - I don't have a clue what file that is. I didn't code the site (it's in ASP, which I don't do). I write PHP, and always have an index.php that assembles the page and pulls in what's needed based on the URL (i.e. index.php contains no actual page content). I'm assuming a typical ASP site works similarly, but not sure what the corresponding file would be. I tried the General.asax or Global.asax but got an error page back.
m
0
l
a b L Programming
December 18, 2012 7:55:23 PM

.asax files aren't pages. Page files are .aspx ones. Since you do PHP programming I'm sure you know HTML. Just find the .aspx file which is the front page - I'm sure it shouldn't be too hard.
m
0
l
December 18, 2012 8:09:51 PM

That's what I thought, but it's definitely .asax. More than one of them too, so I don't think anyone made a typo. And I think you missed my point about my index.php pages - they're not homepage content like traditional HTML. It's a pure PHP page for assembling the output from header+content+footer. So I'm expecting to find a similar file in an ASP site.

I've found the homepage content file but firstly, I don't think that's what I need to be pointing to (I should surely be pointing to a file that routes page requests and pulls in assets?) and secondly, that index.aspx (this one is .aspx) isn't located in the site root. Is it even possible to add paths to the hosting option that searches for default files? None of the existing entries contain a path - it seems to be purely the root that's searched.
m
0
l
a b L Programming
December 18, 2012 8:16:48 PM

I am still a beginner in ASP.NET, but I do think you need to point to the homepage content file. And I do believe that it searches all subfolders for that file.
m
0
l
December 18, 2012 8:25:05 PM

OK, so you reckon add the full path in the list of default pages?

EDIT: Sorry I misunderstood there, you're saying that isn't necessary. But when I added the entry, it didn't open the file, so it looks like it does either need full path or for the file to be located in the root. I'll try the full path tomorrow and post back the results. Thanks for helping out with this :-)
m
0
l
a b L Programming
December 18, 2012 8:26:59 PM

Try relative path. Though I still think file name should be enough.
m
0
l
December 19, 2012 9:04:09 AM

No luck. /Views/Home/Index.aspx returns a 'path not correct'. Same with /public_html/... and same with /Views/Shared/Site.Master (which is that central file I was looking for). Adding those without the path has no effect, I still wind up at the directory listing. The developer is telling me the hosting needs MVC support, hosting is telling me they already have support (but won't give any suggestion or solution). Most helpful suggestions are coming from a forum user with no stock or involvement in the site!
m
0
l
a b L Programming
December 19, 2012 10:14:03 AM

sam_p_lay said:
I'm honestly not sure. This hosting has an option for .htaccess (Linux-style) URL rewriting, which I tried, but no effect.


.htaccess is for the Apache web server. IIS uses web.config which has its own URL rewrite rule format (it also specifies many other things). If your hosting provider makes lots of references to .htaccess then chances are they are running Apache which won't serve an ASP.NET application by default.

sam_p_lay said:
I assumed Windows hosting would support IIS as default?


It should, because there's little reason to run Windows hosting (which usually costs more than Linux hosting) unless you need IIS. Really budget hosting may not though.

sam_p_lay said:
No luck. /Views/Home/Index.aspx returns a 'path not correct'. Same with /public_html/... and same with /Views/Shared/Site.Master (which is that central file I was looking for). Adding those without the path has no effect, I still wind up at the directory listing. The developer is telling me the hosting needs MVC support, hosting is telling me they already have support (but won't give any suggestion or solution). Most helpful suggestions are coming from a forum user with no stock or involvement in the site!


You don't navigate to specific files in an ASP.NET MVC application (well, it doesn't appear that way in a browser anyway), you navigate to "actions" which piece together a page on the server using one of more files and then send a HTML result to the browser. The actual file/directory structure is irrelevant to the client (except for static content like images). By default the home page would be yourdomain.com/Home/Index, but just going to yourdomain.com should refer to the same thing if routing is set up properly.

Of course you still need to be sure that you are running IIS or Apache that is configured to serve an ASP.NET MVC application. Otherwise they're all just text files.
m
0
l
December 19, 2012 10:32:46 AM

Thanks for your response. The hosting I'm using offers hybrid Windows/Linux hosting (however that works). Don't worry though - I'm not using that. They do have the option for .htaccess though and enabling it creates an .htaccess file in the root (outside of and same level as public_html). I've disabled that though.

The hosting has told me default docs don't matter for this, while the developer told me I should have one (though I'm pretty sure now they meant to say "shouldn't"). So I've removed my entry from the default docs list, enabled 'wildcard mapping to ASP .NET' and set a dedicated application pool for the site. Result now is an error page:

Server Error in '/' Application.

Runtime 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 <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors 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 <customErrors> 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>

Developer told me I'd just upload the files and it'll just work. :pfff: 
m
0
l
December 19, 2012 10:34:47 AM

Also, would .asax be a valid file extension? The files provided contain Global.asax in the root, but I've never heard of .asax extension and have been told it should be .aspx.
m
0
l
a b L Programming
December 19, 2012 10:40:52 AM

.asax are valid files, but they are not page content files. It's so called "Application layer" file.
m
0
l
December 19, 2012 10:47:08 AM

OK renamed back to .asax :-) Hosting is now telling me:

I think I see what's missing. Can you send over a copy of the database in .bak format please? The connection string is pointing to an SQL Express instance at the moment which was probably set up on the developer's PC.

But developer is an unbelievable d1ck and impossible to get responses from. I had wondered about database, but wasn't supplied with one. Hopefully I'll get a reply from them today.
m
0
l
a b L Programming
December 19, 2012 11:19:57 PM

If you change:

  1. <customErrors mode="Off"/>


to:

  1. <customErrors mode="On"/>


You will probably see what's actually causing the site to blow up. That's likely what the hosting guys did to discover the DB issue. Don't leave it set to "On" for production though, as it will spit out lots of information that you don't really want public.

Certainly if the site uses a DB you'll need one though.
m
0
l
!