PDA

View Full Version : آموزش گام به گام کار با هاست



AAgary
دوشنبه 23 فروردین 1389, 15:39 عصر
سلام دوستان :
من تازه کار با asp.net رو شروع کردم و با وی بی برنامه می نویسم .
برنامه هایی که تا به حال نوشتم در لوکال هیچ مشکلی نداشتن اما وقتی در یک هاست آپ می کنم اشکال برام پیش میاد .
من از هاست مجانی http://www.aspspider.com


برای برنامه هام استفاده می کنم اما همش با یک اررور مواجه می شم .
خواستم اگر یکی از دوستان براش امکان داره یک آموزش کامل در این مورد بذاره .
از تغییرات در فایل کانفیگ گرفته تا تغییرات لازم در خود برنامه.
خیلی ممنون می شم .

ironman
دوشنبه 23 فروردین 1389, 15:42 عصر
شما لطف کنید متن خطایی که دارید رو بزارید تا بدونیم مشکل شما در کدوم قسمته !!!!

AAgary
دوشنبه 23 فروردین 1389, 15:48 عصر
Server Error in '/Agary' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'WebApplication1._Default'.

Source Error:

Line 1: <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: /Agary/WebApplication1/default.aspx Line: 1

Version Information: Microsoft .NET Framework Version:4.0.21006; ASP.NET Version:4.0.21006.1

Peyman.Gh
دوشنبه 23 فروردین 1389, 15:50 عصر
پوشه Bin را ایجاد کردید و DLL های پروژه را در آن کپی کردید ؟!

AAgary
دوشنبه 23 فروردین 1389, 16:14 عصر
سلام پروژم پوشه ی بین داره .
اما اصلا من از دی ال الی استفاده نکردم .
برنامم کاملا سادست .
من کل پوشه ی webapp ... رو زیپ کردم و بعد در هاست آپ و آنزیپ کردم

daffy_duck376
دوشنبه 23 فروردین 1389, 17:22 عصر
شما مشکلت اینه که برنامه رو publish نکردی. برنامه رو publish کن خوش چند تا dll میسازه . اونها رو تو هاست کپی کن .

AAgary
دوشنبه 23 فروردین 1389, 20:13 عصر
سلام مجدد دوستان ، قسمت پابلیش رو انجام دادم و جواب داد خیلی ممنونم .
اما چند تا مشکل دارم :
من نمی تونم از تابع msgbox استفاده کنم می شه دلیلش رو بیان کنین؟
بعدش هم اینکه من از system.net.webclient در برنامم استفاده کردم و بعدش هم از downloadfile فرض کنین که می خوام با سرور یک فایل رو دان کنم و لینک مستقیم بگیرم . اما در مورد محل دان بهم access denied می ده و این اررور رو :


Server Error in '/Agary' Application.

Access to the path 'C:\AspSpiderRoot\Agary.rar' is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\AspSpiderRoot\Agary.rar' is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[UnauthorizedAccessException: Access to the path 'C:\AspSpiderRoot\Agary.rar' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +9611170
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) +1142
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) +84
System.Net.WebClient.DownloadFile(Uri address, String fileName) +160

[WebException: An exception occurred during a WebClient request.]
System.Net.WebClient.DownloadFile(Uri address, String fileName) +383
System.Net.WebClient.DownloadFile(String address, String fileName) +32
WebApplication2._Default.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\Agary\My Documents\Visual Studio 10\Projects\WebApplication2\WebApplication2\Defaul t.aspx.vb:6
System.Web.UI.Control.OnLoad(EventArgs e) +115
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

Version Information: Microsoft .NET Framework Version:4.0.21006; ASP.NET Version:4.0.21006.1


آیا می تونم این مشکل رو حل کنم یا اشکال از هاسته ؟
خیلی ممنونم .
پ.ن : برای عزیزانی که مثل حقیر تازه کارن روش پابلیش کردن یک سایت ، اینجا (http://www.itnee.com/Upload/Publish.NET.pdf) رو ببینن .

Peyman.Gh
دوشنبه 23 فروردین 1389, 20:18 عصر
دوست عزیز شما نمی توانید از MsgBox استفاده نمایید.
http://www.barnamenevis.org/forum/showthread.php?t=3082

برای اینکار میتوایند از Alert جاوا اسکریپت استفاده نمایید.


Response.Write("<script> alert('Your Message...'); </script>");

AAgary
دوشنبه 23 فروردین 1389, 20:28 عصر
خیلی ممنونم .
جواب قسمت دوم رو هم لطف می کنین ؟

daffy_duck376
دوشنبه 23 فروردین 1389, 21:00 عصر
Access to the path 'C:\AspSpiderRoot\Agary.rar' is denied.
علتش کاملا معلومه آدرس دهی لینک دانلودت اشتباهه.باید از توابعی استفاده کنی که آدرس جاری رو بدست بیاره .

Peyman.Gh
دوشنبه 23 فروردین 1389, 21:01 عصر
خیلی ممنونم .
جواب قسمت دوم رو هم لطف می کنین ؟

در صورت امکان کدی که از System.Net.WebClient استفاده کرده اید را قرار دهید.

AAgary
دوشنبه 23 فروردین 1389, 22:53 عصر
Dim a As Net.WebClient = New Net.WebClient
Page.Title = TextBox2.Text
a.DownloadFile(TextBox2.Text, Server.MapPath("/agary.rar"))
Label1.Text = "Done!"

AAgary
سه شنبه 24 فروردین 1389, 14:24 عصر
سلام
کسی از عزیزان زحمت این سوال رو می کشه ؟
سورس رو هم قرار دادم . فکر نمی کنم آدرس سرور اشتباه باشه چون از Server.MapPath استفاده کردم

Peyman.Gh
سه شنبه 24 فروردین 1389, 20:38 عصر
دوست عزیز من با این دستور آشنا نیستم اما بنظرم اشتباه انجام داده اید که باید به این صورت باشد :


a.DownloadFile(adress As String , fileName As String)آدرس را شما TextBox2 قرار داده اید و File Name را برابر با Server.MapPath فکر میکنم صحیح نمیباشد دوباره امتحان نمایید.