我已经在IIS上托管了ASP.NET Web服务。但是我无法使用ip访问它。
例如:如果我在同一设备上的浏览器中输入设备ip,则无法访问它。而且在IIS中,当我使用localhost
作为主机名时,可以访问Web服务,但无法访问数据库。
我已附加了屏幕截图,该截图显示了访问Web服务中访问数据库的方法之一时的错误消息。
这是我的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="data source=WIN10D-02198;initial catalog=Chromoscan2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
答案 0 :(得分:0)
您可以将网站发布到IIS上的“默认网站”。
如果不存在,则可以执行以下操作:
Default Web Site
” inetpub\wwwroot