我使用Entity Framework将ASP.NET Web服务托管在IIS中,但是无法从外部访问它

时间:2018-07-11 04:32:27

标签: asp.net iis

enter image description here我已经使用Entity Framework开发了Web服务。当我通过IIS托管Web服务时,却无法访问它。在localhost上,它工作正常。

我尝试授予SQL Server Management Studio访问权限。尝试过Windows身份验证和SQL Server身份验证。不知道怎么了另外还尝试对web.config文件进行更改。

这是我的web.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="entityFramework" 
                 type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.6.1" />
        <httpRuntime targetFramework="4.6.1" />
    </system.web>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <protocolMapping>
            <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
        <directoryBrowse enabled="true" />
    </system.webServer>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        <providers>
            <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
    </entityFramework>
    <connectionStrings>
        <add name="Chromoscan2Entities"  
             connectionString="metadata=res://*/CytoModel.csdl|res://*/CytoModel.ssdl|res://*/CytoModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=WIN10D-02198;initial catalog=Chromoscan2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
             providerName="System.Data.EntityClient" />
    </connectionStrings>
</configuration>

0 个答案:

没有答案
相关问题