Issue
Ok, I am a beginner and trying to deploy a web application in ASP.Net MVC 5
application in C# language
developed using Code First Migration
at godaddy server. I am completely surprised and disappointed to see that no proper material is available online to guide a beginner to deploy the app. Anyways after googling for a while I followed below steps and still not able to see my web app LIVE:
Step 1: Bought a domain name
Step 2: Bought a Plesk Server
Step 3: Linked the domain name to Plesk Server
Step 4: Now Went to plesk server settings and Downloaded the Publish Profile
Step 5: Now in Visual Studio I right clicked on solution and clicked on "Publish"
Step 6: Imported the downloaded publish profile, and Selected Web Deploy in Connection tab and Validated the connection to the server. Password is for the Plesk Server.
Step 7: Now I saw many checkboxes in the Settings tab, I chose options shown in the screenshot.
Image 1:
Image 2:
ASSUMING Above Setting is CORRECT which I am not SURE.
After Successful Publish
I get below Error when I open the web app:
Error 1:
System.Security.SecurityException: Request failed
After searching on Internet I found I need to add
<trust level="Full"/>
in my Web.Config FIle. So, in my local VS I made change to Web.Config file like below:
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
<customErrors mode="Off"/>
<trust level="Full" />
</system.web>
Moving On, Now again I published the app and Now I see below error:
Error 2:
System.ComponentModel.Win32Exception: This program is blocked by group policy. For more information, contact your system administrator
Now again I searched google and found out that I need to Tick Mark the "enable precompiling the website"
Image 3:
Now after all this When I run the application I get below error:
Image 4:
P.S: I logged in to Plesk Server and I can see my project files got uploaded to the server. Can someone guide me on what is the issue. Have I made any mistakes in WEB DEPLOY SETTINGS, Or Web.Config or even Connection String?
Solution
Ok after much struggle I was able to find the solution. Below is what I did.
Step 1: Follow all the steps mentioned in the question.
Step 2: If you are developing the application with SSL Enabled, Kindly disable it for the time being, by going to the property of the Solution.
Step 3: Now check your FilterConfig.cs file and make sure YOU DO NOT HAVE below line of code.
filters.Add(new RequireHttpsAttribute()); // COMMENT THIS LINE
Step 4: Now go to plesk Server, Create a Database. Give it a User.
Step 5: In Asp.Net Settiings, Create a connection string Data Source=184.XXX.XX.X,1433;Network Library =DBMSSOCN;Initial Catalog=GIVEHEREDATABASENAME;User ID=DBUSERNAME;Password=DBUSERPASSWORD;
Step 6: Now go to ASP.Net Settings, from there Copy the Default Connection String.
Step 7: Now while deploying the project paste this connection string in the Connection String section in VS.
Step 8: Click Publish and you should be all set.
Answered By - Unbreakable Answer Checked By - Gilberto Lyons (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.