asp.net publish site problem- pages with DB are not found (404) - asp.net

i'm using VS 2008, asp.net, framework 3.5
this is the first time i built an asp.net website.
the site is quite simple, with some pages getting there text onLoad from a DB (ms access),
and some with plain text.
it works fine on debugging.
i used publish web site, and got a preCompiled website folder on my computer.
i copied all the files to my hosting server.
the pages that don't need DB work fine, all the ones that call the DB on loading are not found.
i thought it was permissions, but the hoster checked it up with me. the db folder has all permissions.
i have 2 questions:
1. how do i get exact info on the error, better than 404 ??
2. what's happening? why doesn't it work?
thanks for reading this far..

I know it sounds obvious but did you leave your testing connection string in the web.config or where so ever you keep it?
You may have used an alias for the DB you are using on your local machine but your ISP will not have the same alias. That would be my first port of call.
To get a better error message you could turn off custom errors in your web.config and perhaps use trace.axd.

Related

ASP.NET WEB API 2 Works Locally But Not On Production Web Server

I've developed a new WEB API 2 that works great locally, however when I upload the same code to my production server (Arvixe in this case) all I get is a 404 when I call it. I've spent HOURS searching the web, reading forums, etc.. and have been able to find no resolution, so I'm asking here as my last effort.
I'm currently only testing with the default project that gets created when you do New Project > ASP.NET Web API 2 Empty Project in Visual Studio. This creates an empty project with a single ValuesController. You should be able the JSON response by called /api/values, but this doesn't even work.
I'm using Fiddler to test the API locally and on the web server.
http://localhost:1993/api/values <--- works great
but
http://api.mydomain.com/api/values <--- returns 404
Note: I created a subdomain "api" in this case, but everything for the code for the API is unchanged from when it was created.
Why in the world does this work locally but not on the production web server?
That the server returns 404 (Not Found) may indicate a lot of things. However you can check using the following step:
Add a simple text document like readme.txt to your a folder sub-domain http://api.mydomain.com, and try to get access to that. If you can't access to that file, it means that the subdomain is not configured properly.
Publish the webservice using the "Publish" functionality, so that all DLLs will be copied.
After that,try to reach the Web ApI again.
Hope that help.
"Note: I created a subdomain 'api' in this case, but everything for the code for the API is unchanged from when it was created."
Above comment of your's is suspicious, you should publish your WEB API application in the root directory. Like if http://example.com is pointing to "MyExample" folder, then application should be published on "MyExample" folder.
After that you will be able access your api with http://example.com/api/{controller}/{action}
Just a simple suggestion which I'm sure you have already considered, but have you opened the http port 80 on the server's firewall?
Also stick a plain old html file in the root of your project and see if the server serves it up.
in your case, since you create a subdomain of 'api', you should try
http://api.mydomain.com/api/api/values
note that if you're using database for the function, you should change the connectionString in your web config
Please verify the .net framework on you hosted domain that may be old one.
Web api 2 is supposed on 4.5 framework.
One reason for web api 2 method working OK on local machine but not on production server is that the method you are calling is working on local machine but not on remote server. In such a case you will receive message 404 or 500, and you would be lost why this routing is failing.
Why a method would fail on remote server, well there may be many reasons. For me, I was querying database in my method and my connectionString was not set for remote server.
One way of resolving it would be to put some very simple code in that particular method and test that routing is working. Then check your original code for errors reasons.

Request for Sitecore page returns IIS 404

I request a page in Sitecore and I get a 404 from IIS. The site works on my development environment & staging. This is on the production machine, which is a new install. I've never actually seen it work. The fact that it's giving me an IIS 404 (instead of a Sitecore 404) seems to indicate that whatever handler Sitecore uses isn't being recognized or isn't set up properly. I'd appreciate any suggestions about where to begin looking or what the issue might be.
We're in II7 running in classic mode.
I have the same issues if I run Sitecore in classic mode. Why don't you try running in Integrated mode, for all handlers to work propperly? Your Sitecore login page works, so that indicates that you have unzipped the Sitecore folder corretly. I'd suggest you to try Integrated mode.
It sounds like a permissions issue, check that Network Service (or Application Pool Identity) has the correct access to all of the Sitecore folders.
This looks like a fairly good guide on this:
Sitecore folder & IIS permissions
You could also try exporting the IIS setup for production and staging and comparing the two to make sure nothing odd with the setup.
Have you tried running the installer? If you are cleaning up someone else's install, there's no telling what they did... far easier to start again. You can easily connect to an existing database, or install a package with all your content once you've got a good working Sitecore instance.

Web.Config Issues and Analyzers

I have a set of ASP.NET membership tables online with my hosting with godaddy. I can run my site locally and connect to the online membership table fine and can create accounts etc.. So basically I got everything hooked to reference everything online.
But I get a 500 Internal Service error when I try to view the site. I can't look at the event viewer cause godaddy does not allow that. When I rename the web.config and refresh the site I can either get to the login or register page but when it try to save data it bombs.
So is their a good web.config analyzer that can tell me whats wrong? Cause it works locally referencing online db so it should work fine, right?
Thanks
You can get a lot of information out of trace or add a logger like log4net and write log messages to a text file. That can tell you what is wrong.

can asp.net routing 3.5 sp1 do this issue?

I have a folder(/MyFolder/) with a dedicated web.config in it that does an impersonating
In that folder I have an asp.net file that use Microsoft report viewer 8.0 named MyReport.aspx
When I view this folder on my machine, it's working perfectly without issue
When I publish my project to the dev server and I'm trying to view the report, I have an issue where the the user that run IIS doesn't have access to something, (rsAccessDenied)
Can asp.net routing cause this issue?
(I'm not at work right now so I can only go by memory so it will be hard to provide more information)
Your impersonation is probably not set up correctly. Check the User.Identity.Name when running locally and on the server.
http://msdn.microsoft.com/en-us/library/system.web.httpcontext.user.aspx
In the end, asp.net routing was causing this issue, the web.config wasn't getting loaded.
I had something like this:
http://ip/myreport.aspx
I had to change it to
http://ip/reports/myreport.aspx
I had to have the folder in which the web.config was located in the url

500 - Internal server error for ASPX page

I have created one test.aspx and my local machine it is working fine. Once I upload the same to server the page is not working. It's showing
500 - Internal server error. There is a problem with the resource you
are looking for, and it cannot be displayed.
It is impossible to help you without getting more info about the IIS configuration on your local machine and the server.
However, here's a quick stab of some things you should look at:
Check if Asp.net is installed on the server.
Make sure your app is targeting the proper .Net version that is on the server.
Check if all the assemblies your code is using are deployed correctly on the IIS server.
Add some exception handling and error logging to your code.
In particular, I'd venture to make a wild guess that your page is using some code that requires the IIS7 integrated pipeline and your server is either running IIS6 or is running IIS7 in classic mode. Though this is a stab in the dark and could turn out to be completely wrong. :-)
500 server errors are as useful as saying 'something broke'. They are the result of literally any exception you code throws plus anything else IIS croaks on. From your error msg, it sounds like an IIS config issue but it could still be your code. attaching a debugger to it would eliminate that possibility.
If you haven't looked at the server event log you can see if it registered anything.
There are a number of things that you can do to try to get a better, more specific exception. One way I try to diagnose them is to connect a remote debugger so I can see what's going on. If you have access to do so, I'd go that route.
You will need admin access to the server to install the Visual Studio remote debugging client (I'm assuming this is a .net app).
Another thing that can help are try/catch blocks and logging to a file or the event log--but have have to change your app most likely to implement that.
You have probably forgotten to upload the associated .dll. Have you tried right clicking on the project and using the publish feature?
If you are using IE, then you also need to turn off the "Show friendly error messages" option in Tools - Options - Advanced settings so that you get more details.
You may also need to change the web.config file so that error message details are shown, see the CustomErrors tag.

Resources