WCF+EF+mysql发布到IIS7上
时间:2021-07-01 10:21:17
帮助过:11人阅读
<?xml version="1.0" encoding="utf-8"?>
2 <configuration>
3 <configSections>
4 <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6 <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
7 </configSections>
8 <appSettings>
9 <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
10 </appSettings>
11 <system.web>
12 <compilation debug="true" />
13 </system.web>
14 <entityFramework>
15 <providers>
16 <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
17 <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
18 </providers>
19 <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
20 <parameters>
21 <parameter value="mssqllocaldb" />
22 </parameters>
23 </defaultConnectionFactory>
24 </entityFramework>
25 <system.serviceModel>
26 <services>
27 <service behaviorConfiguration="behav1" name="Services.GetServerInfoService">
28 <endpoint address="" binding="wsHttpBinding" bindingConfiguration="" contract="Contracts.IGetServerInfo" />
29 <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
30 </service>
31 </services>
32 <behaviors>
33 <serviceBehaviors>
34 <behavior name="behav1">
35 <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
36 <serviceDebug includeExceptionDetailInFaults="true" />
37 </behavior>
38 </serviceBehaviors>
39 </behaviors>
40 <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
41 </system.serviceModel>
42 <connectionStrings>
43 <add name="testEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;password=123456;persistsecurityinfo=True;database=test"" providerName="System.Data.EntityClient" />
44 <add name="testEntities2" connectionString="metadata=res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl;provider=MySql.Data.MySqlClient;provider connection string="server=localhost;user id=root;password=123456;persistsecurityinfo=True;database=test"" providerName="System.Data.EntityClient" />
45 </connectionStrings>
46 <system.webServer>
47 <modules runAllManagedModulesForAllRequests="true" />
48 <!--
49 若要在调试过程中浏览 Web 应用程序根目录,请将下面的值设置为 True。
50 在部署之前将该值设置为 False 可避免泄露 Web 应用程序文件夹信息。
51 -->
52 <directoryBrowse enabled="true" />
53 </system.webServer>
54 <system.data>
55 <DbProviderFactories>
56 <remove invariant="MySql.Data.MySqlClient" />
57 <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
58 </DbProviderFactories>
59 </system.data>
</configuration>
4.创建svc文件:
内容: <%@ ServiceHost Language="C#" Debug="true" Service="Services.GetServerInfoService" %>
5.设置IIS, 右键:添加应用程序
HTTP 404.2 - Not Found" IIS 7.5 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理
http://blog.csdn.net/testcs_dn/article/details/8726480
C:\Windows\Microsoft.NET\Framework\V4.0.30319\aspnet_regiis -i
5.设置 应用程序池:高级:启用32位应用程序True
4.0的 设置为允许
处理程序映射的设置。
访问地址:http://localhost//IISHostService/Service.svc
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis
http://www.cnblogs.com/kesalin/archive/2012/08/20/host_wcf_in_iss.html
WCF+EF+mysql发布到IIS7上
标签:1.0 ima 右键 contract exchange 根目录 orm arc contex