running site on IIS server gives an error - iis-7

I'm uploading my site on IIS server and then it gives an error 500(Internal Server Error), when i'm trying to create new user.
But the same code is perfectly run on localhost.
I think the error is because of web.config file.
I'm using Apache server on local machine. for hosting I'm using IIS server.
here is my web.config file code :
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
please help me,
thanks in advance.

You have to install URL Rewrite on the IIS server.
STEPS:
Logon to the IIS server (either; console or RDP).
Download the MSI installer file the corresponds to your server's platform; x86 or x64.
Double-click on the MSI installer file. The installation wizard should walk you though the steps.
Once you're done, try to reload the site from your browser.

You may need to install the URL Rewrite module via Microsoft Web Platform installer first. After that, select the website/application in question and it will appear within the 'Features view' of IIS. You can then set it up as needed.

Related

Vue.js not scaling after deployment to windows server 2019 IIS

After npm run serve everything's working fine. After i deployed my app with API in ASP.NET application doesnt scale at all. I use Router and History. Authentication for annonymous users is enabled and static content is installed. Console doesn't show any errors.enter image description here
Links to screenshots:
Local run
IIS
What do you mean that vue.js not scaling? The second component display abnormally, is it right?
It might be something wrong with Javascript code snippets working.
Did you install the URL Rewrite extension in IIS and add the below rules in the webconfig file?
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Handle History Mode and custom 404/500" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.html" />
</rule>
</rules>
</rewrite>
Here is URL Rewrite extension.
https://www.iis.net/downloads/microsoft/url-rewrite

Copy DOTNetNuke site to new 1and1 shared hosting

Hope someone here has experience of this because I have no clue! Let me say from the start that I've got no experience with asp.net or DotNetNuke.
I've recently started up a small web hosting company to get some extra cash and I've got a client who wants to come on board. The current host of their website has provided me with the source files and a SQL Server db backup. The site was created using DotNetNuke.
I've restored the database and uploaded the source files, I also update the web config with the new connection details. I had hoped it would just work... but it didn't. I'm getting the following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration
data for the page is invalid.
The Config Source box on the error page has
-1;
0:
and the 0 is in red.
Hope some can help with this, not sure what info you need so I'll leave it there for now.
Thanks a lot.
Alex
**** Update ****
I can't install anything on the server because it's shared hosting with 1and1, I don't get direct access to the server. I'll contact 1and1 and make sure that URL rewriter is installed.
The web.config is too big to put the contents into the post. So here's a link to it:
web.config
Thanks in advance.
Cheers
Alex
It could be unrelated to DotNetNuke itself. Error 500.19 means that there is a problem with the web.config file, see IIS HTTP Error 500.19.
First try to install the IIS URL rewriter (http://www.iis.net/downloads/microsoft/url-rewrite) on the server. That is the most common missing IIS plugin. If that does not work then post the web.config file so others can see and try to find the problem.
UPDATE
It is very likely the URL rewriter. Take a look at the web.config, lines 98 to 120. You will see the node.
<rewrite>
<rules>
<rule name="LowerCaseRule1" stopProcessing="true">
<match url="[A-Z]" ignoreCase="false" />
<action type="Redirect" url="{ToLower:{URL}}" />
</rule>
<rule name="CanonicalHostNameRule1">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.test\.co\.uk$" negate="true" />
</conditions>
<action type="Redirect" url="http://www.test.co.uk/{R:1}" />
</rule>
<rule name="oldHome" stopProcessing="true">
<match url="^index.html(.*)$" />
<action type="Redirect" url="/" />
</rule>
<rule name="oldLodges" stopProcessing="true">
<match url="^lodges.html(.*)$" />
<action type="Redirect" url="/HolidayLodges.aspx" />
</rule>
</rules>
</rewrite>
You can remove it. It doesn't seem to be very important for the functionality of the website. Just some legacy stuff.
Second DNN has its own URL rewriter and I've never seen them being used at the same time. It could only lead to problems if both rewriters are trying something similar.
Also take a look at line 29, an Entity Framework connection string. Not sure why that is needed for DNN.
<add name="newsellerdwebsiteEntities1" connectionString="metadata=res://*/Model.Database.csdl|res://*/Model.Database.ssdl|res://*/Model.Database.msl;provider=System.Data.SqlClient;provider connection string="data source=**;initial catalog=**;user id=**;password=**;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
And line 35, AutoUpgrade should ALWAYS be set to false, And to be sure there is no upgrade hack delete the InstallWizard.aspx, InstallWizard.aspx.cs, UpgradeWizard.aspx and UpgradeWizard.aspx.cs from the /Install folder. This only applies when the site is functioning.
<add key="AutoUpgrade" value="true" />

Porting a Web.Config to ASPNET5

I upgrading my project to ASPNET5. I'm hitting a snag regarding upgrading my web.config file.
I tried using Microsoft.Framework.ConfigurationModel.Xml package to read a URL Rewrite configuration. The config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MainRule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" matchType="Pattern" pattern="api/(.*)" negate="true" />
<add input="{REQUEST_URI}" matchType="Pattern" pattern="signalr/(.*)" negate="true" />
</conditions>
<action type="Rewrite" url="default.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
but of course I'm getting duplicate key issues when it tries to convert it to the object that aspnet5 uses.
Whats the best way to port your existing web.config to the new aspnet model? This is a small case I realize but in the real world these configs are really intense.
I've created an example project that I'm hoping to share with others when i get a few of these cases figured out.
the web.config file you posted only has url rewrite rules for iis. Do you really need to access those from your app? IIS will read those directly from the web.config but you shouldn't need that stuff in your app so you don't need to try to parse that file with the new classes in Microsoft.Framework.Configuration at all.
if your app needs some other settings then you might as well use a json.config file as shown in many examples for your own application settings.
you can still drop that web.config file into the application root and assuming your app is hosted in IIS it should still do its job and tell IIS to do some url rewriting. you should not rename it to config.xml as it appears you have done, since IIS won't notice the file unless it is named web.config
why would you need to access those url rewrite rules from application code at all since it is IIS and not application code that does the url rewriting?
I think the new paradigm is use json.config and/or environment variables in azure for application configuration
The only thing you might still use a web.config file for is IIS configuration but that is separate from application configuration and that is the only thing you would use web.config files for going forward and you should not need to access web.config file from application code at all.

Published web site does't recogonize the rewrite element in web.config

All, I was stuck with a problem when I deploy a web site. I found there is an element named rewrite in the web.config.
<rewrite>
<rules>
<!-- below rule will abort api request when the request to pattern "apis/v.*" is of "http" method-->
<rule name="AbortApiHTTPRequest">
<!-- Note:
the below pattern is assumed that all apis conain prefix "apis/v", e.g. apis/v3/aaauth
if there are some exceptions for the assumption, below pattern needs to be updated.
-->
<match url="^apis/v.*$" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="AbortRequest" />
</rule>
<!-- below rule will redirect all non-https requests except for above requests to https request.-->
<rule name="RedirectToHTTPS" stopProcessing="true">
<match url="^.*$" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{SERVER_NAME}/{R:0}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
When I remove the element everthing is ok, the website works well. Otherwise I got a error says.
HTTP Error 500.19 - Internal Server Error The requested page cannot be
accessed because the related configuration data for the page is
invalid.
After I did some research, I found this question talking about it. I am not sure if it is the cause of the problem. seems it is just a xml syntax validation of Visual studio. Does it really matter with the deployment of web site in IIS 7?
Anyway, I also followed the instructions of the post , But I failed to get it works .even I run the cmd as the administrator. the error says below.
Failed to open file Xml\Schemas\DotNetConfig.xsd. Make sure that the
script is run in the elevated command prompt.
I wandered if I have the enough previlige to run cscript command ? thanks.
More
If I run the project in the Visual Studio with the Asp.net development server, It can work without any error. But If I published the project to the IIS in my computer. It doen't work.
The rewrite directive is used by URLRewrite module for IIS.
If the module is not installed, you will get an error similar to the above. You can either install the module if you need URLRewriting - or - comment out the entire <rewrite> section.

WordPress 3.0.1 Install on MS IIS v6 Web Server

I have just installed WordPress 3.0.1 running on MS IIS 6 Windows Server that I developed from my Mac OS X platform.
Note that my WordPress setup is under the following directory structure:
c:\inetpub\wwwroot\MYSITE
The problem here is though, with the site up and running, it can't seem to find any of my pages like "About Us" even though I have set them up correctly within the permalinks side of things.
I am getting:
HTTP Error 404 - File or directory not found. Internet Information Services (IIS)
Is it something to do with permalinks/.htaccess file not working on MS II6?
.htaccess files are for Apache HTTPD. They don't work with IIS. For IIS you need to create a "Web.config" file and add the following lines to it.
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
DOESN'T WORK IN IIS6:
As Kev points out, this code doesn't work in IIS6. From a little googling I understand that URL rewriting is not at all possible with IIS6. If anyone knows another way, please update here.
POSSIBLE ALTERNATIVE FOR IIS6?
Is it possible to use ISAPI_Rewrite or UrlRewriter.NET in this situation? Can someone clarify on this?

Resources