Richten Sie ein entsprechendes Veröffentlichungsprofil für Ihre Umgebung ein. Wenn der App-Pool die notwendigen Rechte hat, wird die Datenbank automatisch erstellt.

Startet die Anwendung zum ersten Mal existiert noch kein Benutzer. Dieser wird über den Aufruf des Controllers “/Account/CreateDefaultUser” im Browser erzeugt werden. Der erzeugte Benutzer sollte unbedingt anschließend auf einen sinnvollen Anwendernamen und -passwort umgestellt werden.

Beispiel für ein Veröffentlichungsprofil mit Web-Deploy. Folgende Stellen müssen angepasst werden

  • SiteUrlToLaunchAfterPublish
  • MSDeployServiceURL
  • DeployIisAppPath
  • PublishDatabaseSettings\ObjectGroup\Destination
  • PublishDatabaseSettings\ObjectGroup\Object\PreSource
  • PublishDatabaseSettings\ObjectGroup\UpdateFrom\Source
  • ItemGroup\MSDeployParameterValue\ParameterValue
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
    <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>http://server.company.de/ba_training</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <MSDeployServiceURL>http://server.company.de</MSDeployServiceURL>
    <DeployIisAppPath>Default Web Site/ba_training</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName></UserName>
    <PublishDatabaseSettings>
      <Objects xmlns="">
        <ObjectGroup Name="DefaultConnection" Order="1" Enabled="False">
          <Destination Path="Data Source=SQLServer;Initial Catalog=ba_training;Integrated Security=True" Name="data source=SQLServer;integrated security=SSPI;initial catalog=ba_training" />
          <Object Type="DbDacFx">
            <PreSource Path="Data Source=.\;Initial Catalog=ba_training;Integrated Security=True" includeData="False" />
            <Source Path="$(IntermediateOutputPath)AutoScripts\DefaultConnection_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
          </Object>
          <UpdateFrom Type="Web.Config">
            <Source MatchValue="data source=.\;integrated security=SSPI;initial catalog=ba_training" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
          </UpdateFrom>
        </ObjectGroup>
      </Objects>
    </PublishDatabaseSettings>
  </PropertyGroup>
  <PropertyGroup>
    <UseMsDeployExe>true</UseMsDeployExe>
  </PropertyGroup>
  <Target Name="SetupCustomAcls" AfterTargets="AddIisSettingAndFileContentsToSourceManifest" Condition="'$(ExcludeApp_Data)' == 'False'">
    <Message Text="Setting ACL on App_Data" />
    <ItemGroup>
      <MsDeploySourceManifest Include="setAcl">
        <Path>$(_MSDeployDirPath_FullPath)\App_Data</Path>
        <setAclAccess>Read,Write,Modify</setAclAccess>
        <setAclResourceType>Directory</setAclResourceType>
        <AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
      </MsDeploySourceManifest>
    </ItemGroup>
  </Target>
  <Target Name="SetupCustomSkipRulesForAppData" AfterTargets="AddIisSettingAndFileContentsToSourceManifest">
    <Message Text="Setting Skiprules for App_Data" />
    <ItemGroup>
      <MsDeploySkipRules Include="SkipFilesInAppDataFolder">
        <SkipAction>Delete</SkipAction>
        <ObjectName>filePath</ObjectName>
        <AbsolutePath>$(_DestinationContentPath)\\App_Data\\.*</AbsolutePath>
      </MsDeploySkipRules>
      <MsDeploySkipRules Include="SkipFoldersInAppDataFolders">
        <SkipAction>Delete</SkipAction>
        <ObjectName>dirPath</ObjectName>
        <AbsolutePath>$(_DestinationContentPath)\\App_Data\\.*\\*</AbsolutePath>
      </MsDeploySkipRules>
    </ItemGroup>
  </Target>
  <ItemGroup>
    <MSDeployParameterValue Include="DefaultConnection-Web.config Connection String">
      <ParameterValue>data source=SQLServer;integrated security=SSPI;initial catalog=ba_training</ParameterValue>
    </MSDeployParameterValue>
    <MsDeploySkipRules Include="CustomSkipFile">
      <ObjectName>filePath</ObjectName>
      <AbsolutePath>Customer.config</AbsolutePath>
    </MsDeploySkipRules>
  </ItemGroup>
</Project>