반응형
폴더에 디렉토리 만든다 ㅎㅎㅎ
IIS 서비스에 설정하나다 ㅎㅎㅎ
그리고 웹서비스 확장에 거시기 ASP.net 2.0이 허용되는지 확인한다 ㅎㅎㅎ
WebService 만들때 포트를 8900번으로 설정한다 왜? 그냥
DataSet ds = null;
[WebMethod]
public DataSet GetEmployee()
{
SqlConnection conn = new SqlConnection(@"data source=KWANG-SIK\SQL2005;initial catalog=northwind ; user ID = sa; password = p@ssw0rd! ") ;
SqlCommand cmd = new SqlCommand("SELECT * FROM employees",conn);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
ds = new DataSet();
adapter.Fill(ds);
return ds;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using SmartControl.SmartService;
namespace SmartControl
{
public partial class GridControl : UserControl
{
public GridControl()
{
InitializeComponent();
}
private void GridControl_Load(object sender, EventArgs e)
{
DataSet ds = null;
//웹서비스 호출
//SmartControl.SmartService.Service websrv = new SmartControl.SmartService.Service();
Service websrv = new Service();
ds = websrv.GetEmployee();
dgvEmployee.AutoGenerateColumns = true;
dgvEmployee.DataSource = ds.Tables[0];
}
}
}
<title>제목 없음</title>
</head>
<body>
<form id="form1" runat="server">
<div>
너오나?
<object id = "smartobject" style ="width=480; height=300;"
</div>
</form>
</body>
</html>
에러 난다??????
왜그럴까?????
HTTP://LOCALHOST
코드 그룹만들었는데 자신의 그룹만 만들어서 그렇다 그래서 자신것만잘보인다
여기서 문제점은????
그런데 웹사이트 들어갈때 마다
프레임워크 설정해야한다
여기서 필요한것은뭐???
바로 클릭 원스 ~!!!!! 많이 들어봣지요?? 클릭원스
using System;
using System.Collections.Generic;
using System.Text;
using System.Security;
using System.Security.Policy;
using System.Windows.Forms; //참조 추가에서 dll 참조함
namespace SmartCas
{
class Program
{
static void Main(string[] args)
{
// Machine(Local) 영역을 접근한다.
const string userPolicyLevel = "Machine";
PolicyLevel level = null;
System.Collections.IEnumerator ph = System.Security.SecurityManager.PolicyHierarchy();
//Machine 레벨을 가져온다.
while (ph.MoveNext())
{
level = (PolicyLevel)ph.Current;
if (level.Label == userPolicyLevel)
break;
}
// 이미 추가가 되었는지 확인한다.
foreach (CodeGroup group in level.RootCodeGroup.Children)
{
if (group.Name == "HOONS")
return;
}
//권한생성
NamedPermissionSet permissionSet = new NamedPermissionSet("FullTrust");
PolicyStatement policyStatement = new PolicyStatement(permissionSet);
//URL멤버쉽 생성
IMembershipCondition membership = new UrlMembershipCondition(@"http:// localhost:2005/*");
//코드그룹에 추가
UnionCodeGroup cg = new UnionCodeGroup(membership, policyStatement);
//이름생성
cg.Name = "HOONS";
cg.Description = " HOONS Test 입니다.";
// 그룹추가
level.RootCodeGroup.AddChild(cg);
//적용
System.Security.SecurityManager.SavePolicy();
System.Windows.Forms.MessageBox.Show("보안 설정이 완료되었습니다.", "알림");
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Security;
using System.Security.Policy;
using System.Windows.Forms; //참조 추가에서 dll 참조함
namespace SmartCas
{
class Program
{
static void Main(string[] args)
{
// Machine(Local) 영역을 접근한다.
const string userPolicyLevel = "Machine";
PolicyLevel level = null;
System.Collections.IEnumerator ph = System.Security.SecurityManager.PolicyHierarchy();
//Machine 레벨을 가져온다.
while (ph.MoveNext())
{
level = (PolicyLevel)ph.Current;
if (level.Label == userPolicyLevel)
break;
}
// 이미 추가가 되었는지 확인한다.
foreach (CodeGroup group in level.RootCodeGroup.Children)
{
if (group.Name == "HOONS")
return;
}
//권한생성
NamedPermissionSet permissionSet = new NamedPermissionSet("FullTrust");
PolicyStatement policyStatement = new PolicyStatement(permissionSet);
//URL멤버쉽 생성
IMembershipCondition membership = new UrlMembershipCondition(@"htt://192.168.0.81");
//코드그룹에 추가
UnionCodeGroup cg = new UnionCodeGroup(membership, policyStatement);
//이름생성
cg.Name = "HOONS";
cg.Description = " HOONS Test 입니다.";
// 그룹추가
level.RootCodeGroup.AddChild(cg);
//적용
System.Security.SecurityManager.SavePolicy();
System.Windows.Forms.MessageBox.Show("보안 설정이 완료되었습니다.", "알림");
}
}
}
'.NET > SmartClient' 카테고리의 다른 글
클릭온스 어플리케이션 파리미터 넘기기 ( appref-ms의 argument) (0) | 2011.03.07 |
---|---|
이 응용 프로그램을 설치하거나 실핼할 수 없습니다. 먼저 GAC(전역 어셈블리 캐시)에... (0) | 2010.01.19 |
클릭온스 ClickOnce 실행 중일때 버전 정보 얻기 (0) | 2009.12.31 |
스마트 클라이언트 정의 (0) | 2009.03.03 |
C# 스마트 클라이언트 시작하기 간단한 asp페이지 만들기 (0) | 2008.11.24 |
스마트 클라이언트 시작하기 (0) | 2008.11.24 |