自己写好的WCF, 在本机可以调用, 如何装在客户服务器, 并且可以远程调用?
本机调用, 使用的自托管, 装在远程服务器, 希望能够使用 外网IP连接, 如何设置, 请指教!
以下是我的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="connAppString" value="Data Source=.;Initial Catalog=WMSDB;Persist Security Info=True;User ID=sa;Password=bs2badmin"/>
<add key="connFormsString" value="Data Source=.;Initial Catalog=WMSFormDB;Persist Security Info=True;User ID=sa;Password=bs2badmin"/>
<add key="connImagesString" value="Data Source=.;Initial Catalog=WMSImagesDB;Persist Security Info=True;User ID=sa;Password=bs2badmin"/>
</appSettings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="wsHttpBinding_ServiceBehavior">
<serviceDebug />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="wsHttpBinding_ServiceBehavior"
name="MyWMS.ServerContracts.MyContractsService">
<clear />
<endpoint binding="wsHttpBinding" contract="MyWMS.ServerContracts.IMyContracts"
listenUriMode="Explicit" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8888/MyWMSService" />
<add baseAddress="net.tcp://localhost:9999/MyWMSService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
本机调用, 使用的自托管, 装在远程服务器, 希望能够使用 外网IP连接, 如何设置, 请指教!
以下是我的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="connAppString" value="Data Source=.;Initial Catalog=WMSDB;Persist Security Info=True;User ID=sa;Password=bs2badmin"/>
<add key="connFormsString" value="Data Source=.;Initial Catalog=WMSFormDB;Persist Security Info=True;User ID=sa;Password=bs2badmin"/>
<add key="connImagesString" value="Data Source=.;Initial Catalog=WMSImagesDB;Persist Security Info=True;User ID=sa;Password=bs2badmin"/>
</appSettings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="wsHttpBinding_ServiceBehavior">
<serviceDebug />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="wsHttpBinding_ServiceBehavior"
name="MyWMS.ServerContracts.MyContractsService">
<clear />
<endpoint binding="wsHttpBinding" contract="MyWMS.ServerContracts.IMyContracts"
listenUriMode="Explicit" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8888/MyWMSService" />
<add baseAddress="net.tcp://localhost:9999/MyWMSService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
2、在远程服务器上,把WEB的权限设置对。
无聊我怎么改IP,在别的服务器上都只有
http://localhost:8888/MyWMSService
有效, 其他的不行! 以下是我Hosting 的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyWMS.ServerContracts;
using System.ServiceModel;
using System.Configuration;namespace MyWMS.ServerHosting
{
class Program
{
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(MyContractsService)))
{
host.Opened += delegate
{
Console.WriteLine("Servicing ......");
};
host.Open();
Console.Read();
}
}
}
}
2、你直接用文件夹的【Web共享】,共享出来,就会自动在IIS里面建立虚拟目录;
3、你建好后,需要去IIS里面,启用该虚拟目录的匿名访问权限,否则只有本地能访问。
<add baseAddress="http://localhost:8888/MyWMSService" />
服务器我改成 :
<add baseAddress="http://218.103.102.51/MyWMSService" />
然后在IE输入: http://218.103.102.51/MyWMSService 提示找不到此页
访问权限,网站端口等