PDA

View Full Version : سوال: عدم نمایش سایت



dastyar69
پنج شنبه 16 فروردین 1397, 00:41 صبح
با سلام
دوستان من یک سایت با Asp.net MVC و با Entity Framework Code First ایجاد و اپلود کردم و فایل Web.Config را متناسب اطلاعات سرور ساختم ولی وقتی آدرس سایت را در مرورگر تایپ می کنم پیغام خطای The system cannot find the file specified
را می هد.


آیا کسی از دوستان می داند که مشکل از کجاست؟
لطفا راهنمایی کنید؟

فایل Web.config به شرح زیر می باشد.


<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrame workSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
add name="DataBaseModelContext" connectionString="Password=*******;Persist Security Info=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=Fa lse;MultipleActiveResultSets=True;User ID=*******;Initial Catalog=myDatabase;Data Server=.\\MSSQLSERVER2014" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="/login/Index" timeout="20"></forms>
</authentication>
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsig htsHttpModule, Microsoft.AI.Web" />
</httpModules>
<customErrors mode="On" defaultRedirect="ErrorPageinfo.html">
<error statusCode="403" redirect="Error403page.html" />
<error statusCode="404" redirect="Error404page.html" />
</customErrors>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-5.2.4.0" newVersion="5.2.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsig htsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
</system.webServer>
<system.codedom>
<compilers>
<compiler language="C#‎‎‎‎‎‎‎‎;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform .CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform , Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform .VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform , Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
</compilers>
</system.codedom>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectio nFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
<!--ProjectGuid: CE62ADC1-008F-41CC-8C3A-7ECE7D230973-->

nunegandom
پنج شنبه 16 فروردین 1397, 02:42 صبح
با سلام
۱-پنلتون رو نگاه کنید ببینید از چه .net ای استفاده کرده بعضیا چند تا نسخه .net دارن
۲-نگاه کنید ببینید دیتابیستون ساخته شده یا خیر
۳-توی Global.asax چک کنید که داخل متود protected void Application_Start از
using (var context = new OriginContext()){context.Database.Initialize(force : true);}
استفاده کردین یا نه (اجبار به ساخت دیتابیس بعد از ران شدن برنامه)
۴-آخرین چیزی که به ذهنم میرسه هم connectionstring هست...
۵-هاستینگ دنبال index و بعد default میگرده برای باز کردن صفحه و معمولا DirectoryListing بسته هست

dastyar69
پنج شنبه 16 فروردین 1397, 16:04 عصر
سلام مهندس
ابتدا تشکر می کنم بابت راهنماییتون
1. پلن هاست رو چک کردم نوشته که از آخرین نسخه net. پشتیبانی می کند و من هم در پروژه از نسخه 4.5 استفاده کردم.
2. دیتابیس را روی سرور آپلود کردم، البته فرقی هم نمی کنه چون وقتی DataBase هم آپلود نباشه همین خطا رو می ده. یعنی کامپایل اصلا به این مرحله نمیرسه.
- نکته بعدی اینکه من از Entity Framework Code First استفاده کردم یکی از دوستان یک پروژه mvc را Entity Framework DataBase First استفاده کرده و هیچ مشکلی در اجرا روی هاست نداشت.
- همان طور که می دانید EFCF خودش در صورت نبودن پایگاه داده آن را می سازد. (ولی اینجا ... )
3. فایل Global.asax روی سرور فقط دارای خط کد زیر می باشد.
<%@ Application Codebehind="Global.asax.cs" Inherits="MvcProject.MvcApplication" Language="C#‎‎‎" %>
به نظرم محتوای آن به فایل dll تبدیل شده باشه و از طرفی با خط کدی که شما معرفی کردید همان مشکل برقرار است ( همان طور که عرض کردم کامپایل به اجرای دستورات پایگاه داده نمی رسد.)
4. کانکشن سترینگ هم به صورت زیر و بعد از تگ <configSections> تعریف کردم.


<connectionStrings>

<add name="DataBaseModelContext" connectionString="Server=.\\MSSQLSERVER2014;Initial Catalog=DataBaseName;User ID=UserID;Password=********;" providerName="System.Data.SqlClient" />
5. اینکه هاست دنبال index می گرده، خب من Controller Home را دارم و در آن Action index را تعریف کردم که در localhost بدون هیچ مشکی کار می کند فقط روی هاست مشکل می گیرد. قسمت دوم شماره پنجم (DirectoryListing) را متوجه نشدم.