Solved

.NET application, Web.Config causes 500 - Internal server error

Posted on 2013-10-29
3
2,122 Views
Last Modified: 2013-11-18
Hi everybody.

I will try to be short:

- On VPS server I have an Application running
- Application is in C#, .NET and uses SQL database
- Everything running perfect

I have to move it to the new VPS Server (old one was corrupted, however everything is still running, just can’t add more Virtual HDD).

Moving to:
- New Server (Again Virtual Private Server with windows server 2008 R2)
- Have access to plesk and remote desktop
- Created hosting with plesk.
- Switched in Plesk to .NET version 4.something
- Deployed through remote desktop the application on the new server, used web deploy 3.5
- Deployed SQL Database.
- The marketing part of the website written in PHP/Wordpress, the login part and a whole application in .NET
- It seems to be working perfectly but only Locally. Database connection is working and no issues updating Locally.
- As soon as I try to access from the internet it gives an error “500 - internal server error”

Looks like Web.Config has something what causes problems. Maybe something isn’t installed on the new server in IIS or somewhere else. Web.Config wasn’t changed during the move, makes me think that something is missing in the server configuration.

Since the app is running fine locally, I can’t see any more error info and when I go to IIS settings I can’t adjust them (to make error info display remotely), because it gives an error when I click on ASP in IIS on the server. It doesn’t even open any settings in IIS for the application.

I removed a part of the code from web.config and application seem to open, it doesn’t produce server error (which is good), but it doesn’t function as it has to.

Looks like I need to keep the part of the web.config, just need to make it work.

Please see attached part of the web.config, which causes problem. I couldn’t figure out which part inside of it causes the problem, only by removing everything inside of
<system.webServer></system.webServer>

it gets rid of the error

I think I installed IIS Rewrite add-on too but it doesn't help neither.

Is there a way to figure out what is installed on the OLD server or configuration of it (related to the app) or is there a way to figure out from the attached source code from web.config what else is needed?

If you need to see other parts of web.config or want me to look up something else please let me know.

Code attached below.

Thank you very much for your help

<system.webServer>
    <rewrite>
      <rules>
                <clear />
                <rule name="CanonicalHostNameRule1">
                    <match url="(.*)" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^www\.sampledomainname\.com$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="http://www.sampledomainname.com/{R:1}" />
                </rule>
                <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*/" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
                <rule name="Rewrite rule1 for Default Page Map" enabled="true" patternSyntax="ECMAScript">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                        <add input="{Default Page Map:{REQUEST_URI}}" pattern="(.+)" />
                    </conditions>
                    <action type="Rewrite" url="{C:1}" appendQueryString="false" />
                </rule>
                <rule name="StumbleUpon">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
                        <add input="{QUERY_STRING}" pattern="utm_source" />
                        <add input="{QUERY_STRING}" pattern="gclid" />
                        <add input="{QUERY_STRING}" pattern="submit.x" />
                        <add input="{QUERY_STRING}" pattern="preview" />
                        <add input="{QUERY_STRING}" pattern="news" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
                <rule name="Coupon" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url=".+" />
                    <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
                        <add input="{QUERY_STRING}" pattern="m=R&amp;cc=AAAAAA" />
                    </conditions>
                    <action type="Rewrite" url="/Login.aspx?m=R&amp;cc=BBBBBB" appendQueryString="false" logRewrittenUrl="true" />
                </rule></rules>
            <rewriteMaps>
                <rewriteMap name="Default Page Map" defaultValue="" ignoreCase="false">
                    <add key="/" value="index.php" />
                </rewriteMap>
            </rewriteMaps>
    </rewrite>

    <defaultDocument enabled="true">
        <files>
            <clear />
            <add value="index.php" />
            <add value="default.aspx" />
        </files>
    </defaultDocument>
    <httpRedirect enabled="false" destination="http://www.sampledomainname.com/login.aspx" exactDestination="false" childOnly="false" httpResponseStatus="Temporary" />
    <applicationInitialization remapManagedRequestsTo="IEFrameWarningBypass.html" skipManagedModules="true">
      <add initializationPage="/login.aspx" />
    </applicationInitialization>
  </system.webServer>

Open in new window

0
Comment
Question by:mimark
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 29

Accepted Solution

by:
sammySeltzer earned 300 total points
ID: 39610673
Server error 500 is way too generic to pinpoint the actual error.

Two things you could try.

1, fix your browser.

Internet Options to Advanced tab, then look for show friendly HTTP error messages. Then uncheck that box.

Try testing your app again to see what message you get now.

If that fails, then log into the server hosting your app and simply type the following on address bar.

http://localhost/folder/default.aspx or whatever the name is.

Run it and it will reveal your actual problem.

It is important to use localhost.

Good luck
0
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 39610701
Did you have application request routing installed on the other box? I'm not 100% if the rules you call need it but maybe
0
 
LVL 1

Assisted Solution

by:wimiles
wimiles earned 200 total points
ID: 39650426
If it is working locally, but not remotely (ie you can browse on your local server via browser to 127.0.0.1) then it is most likely a permission issue.

Do you have contents of the site located outside what Plesk knows as your site's home folder?  If so, you will want to add at least read permissions to the psacln user group.  Make sure you remove any denies that may exist.  This will tell you if it is a permissions issue.

If this resolves your issue, you will need to add some information to your disk.security file to make these changes permanent.  Let us know if that works, and we will get you the disk.security file changes.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question