コメント
コメントの投稿
※名前とタイトルが入力されていないコメントでは他のコメントとの区別ができません。
入力されていないコメントには返信しませんのであらかじめご了承くださいませ。
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AspNetTest.TestServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="AspNetTest.TestService">
<endpoint address="" behaviorConfiguration="AspNetTest.TestServiceAspNetAjaxBehavior"
binding="webHttpBinding" contract="AspNetTest.TestService" />
</service>
</services>
</system.serviceModel>
<%@ ServiceHost Language="VB" Debug="true"
Factory="System.ServiceModel.Activation.WebServiceHostFactory"
Service="AspNetTest.TestService" CodeBehind="TestService.svc.vb" %>
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
<ServiceContract(Namespace:="")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class TestService
<OperationContract()>
Public Function GetTestService(ByVal text As String) As String
Return "WCFサービスの受信結果:" + text
End Function
End Class
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WcfServiceTest.aspx.vb" Inherits="AspNetTest.WcfServiceTest" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<style>
.inner {
margin: 30px;
}
.text {
height: 32px;
font-size: 28px;
width:500px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WcfService/TestService.svc" />
</Services>
</asp:ScriptManager>
<div class="inner">
<input type="text" class="result text" />
</div>
<script src="/App_Themes/default/scripts/jquery-1.10.2.min.js"></script>
<script>
$(function () {
var text = "テスト";
var test = new TestService().GetTestService(text, function (result) {
$('.result').val(result);
});
});
</script>
</form>
</body>
</html>
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
<ServiceContract(Namespace:="")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class TestService
<OperationContract()>
<WebGet()>
Public Function GetTestService(ByVal text As String) As String
Return "WCFサービスの受信結果:" + text
End Function
End Class
<configuration>
<system.web>
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding>
<!--HTTPSの場合に必要 -->
<security mode="Transport">
<!-- 基本認証がある場合に必要 -->
<transport clientCredentialType="Basic" />
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
※名前とタイトルが入力されていないコメントでは他のコメントとの区別ができません。
入力されていないコメントには返信しませんのであらかじめご了承くださいませ。