Web サービスを作成し、WCF 4それを でホストしました。プロジェクトの発行 Web セクションでIIS 7次のように指定しました。Service URL:WCF
http://localhost:8084/service1.svc.
web site次に、公開されたポート:4567とタイプ:をバインドhttpしIISます。
To checked it i clicked on `web site` at `IIS` and click on the browse.
It open a following page at my browser:

これは、Web サービスが で正常にホストされていることを意味しIISます。ここで、インスタンス メソッドを呼び出して、ブラウザで出力を返したいと思います。Iservice.csとのサンプルコードを貼り付けさせてくださいservice.svc.cs
#Iservice.cs:
namespace some.decryption
{
[ServiceContract]
public interface Iservice
{
[OperationContract, WebInvoke(Method = "GET", UriTemplate = "/getdata", ResponseFormat = WebMessageFormat.Json)]
string getdata();
}}
一方、私のservice.svc.cs:
public bool getdata()
{
return somenamespace.getfetcheddll();
}
とserviceDll.cs:
namespace somenamespace{
internal static class UnsafeNativeMethods
{
_dllLocation = "some.dll";
[DllImport(_dllLocation, CallingConvention = CallingConvention.Cdecl)]
public static extern bool OnDecryption();
}
public static string getfetcheddll()
{
return UnsafeNativeMethods.OnDecryption();
}}
getdata()ブラウザからメソッドを呼び出すにはどうすればよいですか?
私はsome.dll同じプロジェクトフォルダに入れました。どこにすればいいですか?
編集:
を貼り付けるのを忘れましたweb.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
これを行うために、私はこのブログに従いました:作成に関するウォークスルー