[英]How to host Wcf service in IIS problem?
我已阅读更多文章,但我无法在 IIS 中托管 wcf 服务
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WcfSrv.MyProject.GetTables.ServiceCrm">
<endpoint address="" binding="wsHttpBinding" contract="WcfSrv.MyTechnic.GetTables.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/WcfSrv.MyProject.GetTables/ServiceTest/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True" />
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data.Objects;
namespace WcfSrv.MyProject.GetTables
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
public class ServiceTest : IService
{
public List GetAllData(string CustomerName)
{
using (CrmEntities crmCtx = new CrmEntities())
{
return crmCtx.GetAllDataCustomer(CustomerName).ToList();
}
}
}
}
我尝试托管我的 Wcf 服务 192.168.0.218 我添加了 Srv 文件和 dll 新的虚拟目录,但我不能使用 wcf 服务。 我更改了配置文件最好的问候...
IIS 中托管的 WCF 服务在 IIS 应用程序中表示为特殊内容文件(.svc 文件)。 请参阅此处的 IIS 部分中的托管 WCF 服务部分,如何使用它以及如何托管您的 WCF 服务。
您是否使用aspnet_regiis -i
( C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis -i
) 在 IIS 上(重新)安装了基本的 asp 集成
由于您没有指定确切的错误,因此很难提供帮助,但是需要将 svc 文件绑定在 IIS 中,重新运行上述语句通常可以解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.