Compare commits
19 Commits
74da6e37b0
...
feat/migr-
| Author | SHA1 | Date | |
|---|---|---|---|
| 77379265c2 | |||
| 9b68c09b0b | |||
| cd6bf05352 | |||
| b2c205b160 | |||
| 33439f4a65 | |||
| b5cdf79799 | |||
| 72915ac001 | |||
| e4d7a0d8f3 | |||
| d5f9de06f3 | |||
| bbc129178f | |||
| 40c95100ff | |||
| 1b2731b4b2 | |||
| ae56902758 | |||
| e80059d34e | |||
| a2443032c5 | |||
| 3d2fe532e5 | |||
| 5e83aa26c9 | |||
| 2c789cd4c0 | |||
| 9ecfe08e2e |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -365,3 +365,7 @@ FodyWeavers.xsd
|
|||||||
/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/.vscode
|
/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/.vscode
|
||||||
/EnvelopeGenerator.Tests.Application/Services/BugFixTests.cs
|
/EnvelopeGenerator.Tests.Application/Services/BugFixTests.cs
|
||||||
/EnvelopeGenerator.Tests.Application/annotations.json
|
/EnvelopeGenerator.Tests.Application/annotations.json
|
||||||
|
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/TekH - SoftHSM Test.md
|
||||||
|
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/tekh_softHSM_test.md
|
||||||
|
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/publish-output
|
||||||
|
/EnvelopeGenerator.Server/EnvelopeGenerator.Server/tekh_softHSM_test.md
|
||||||
|
|||||||
@@ -214,6 +214,10 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
bool outSuccess = reader.GetBoolean(0);
|
bool outSuccess = reader.GetBoolean(0);
|
||||||
|
if (!outSuccess)
|
||||||
|
_logger.LogWarning(
|
||||||
|
"PRSIG_API_ADD_DOC_RECEIVER_ELEM returned OUT_SUCCESS=false. DOC_ID={DocId}, RECEIVER_ID={ReceiverId}, Page={Page}",
|
||||||
|
document.Id, rcv.Id, sign.Page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -221,8 +225,6 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
#region Create history
|
#region Create history
|
||||||
// ENV_UID, STATUS_ID, USER_ID,
|
// ENV_UID, STATUS_ID, USER_ID,
|
||||||
string sql_hist = @"
|
string sql_hist = @"
|
||||||
USE [DD_ECM]
|
|
||||||
|
|
||||||
DECLARE @OUT_SUCCESS bit;
|
DECLARE @OUT_SUCCESS bit;
|
||||||
|
|
||||||
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
||||||
@@ -244,6 +246,10 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
bool outSuccess = reader.GetBoolean(0);
|
bool outSuccess = reader.GetBoolean(0);
|
||||||
|
if (!outSuccess)
|
||||||
|
_logger.LogWarning(
|
||||||
|
"PRSIG_API_ADD_HISTORY_STATE returned OUT_SUCCESS=false. EnvelopeUuid={EnvelopeUuid}",
|
||||||
|
envelope.Uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class EnvelopeReceiverAddReadSQL : ISQL<Envelope>
|
|||||||
/// ENV_UID, EMAIL_ADRESS, SALUTATION, PHONE,
|
/// ENV_UID, EMAIL_ADRESS, SALUTATION, PHONE,
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Raw => @"
|
public string Raw => @"
|
||||||
DECLARE @OUT_RECEIVER_ID int
|
DECLARE @OUT_RECEIVER_ID bigint
|
||||||
|
|
||||||
EXEC [dbo].[PRSIG_API_CREATE_RECEIVER]
|
EXEC [dbo].[PRSIG_API_CREATE_RECEIVER]
|
||||||
{0},
|
{0},
|
||||||
|
|||||||
@@ -138,7 +138,9 @@
|
|||||||
SelectedDataItemChanged="@OnSelectedEnvelopeChanged"
|
SelectedDataItemChanged="@OnSelectedEnvelopeChanged"
|
||||||
CustomizeElement="OnCustomizeElement">
|
CustomizeElement="OnCustomizeElement">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" Caption="ID">
|
<DxGridDataColumn FieldName="Id" Caption="ID"
|
||||||
|
SortIndex="0"
|
||||||
|
SortOrder="GridColumnSortOrder.Descending">
|
||||||
<CellDisplayTemplate Context="cellContext">
|
<CellDisplayTemplate Context="cellContext">
|
||||||
@((cellContext.DataItem as EnvelopeDto)?.Id)
|
@((cellContext.DataItem as EnvelopeDto)?.Id)
|
||||||
</CellDisplayTemplate>
|
</CellDisplayTemplate>
|
||||||
@@ -234,7 +236,9 @@
|
|||||||
SelectedDataItemChanged="@OnSelectedEnvelopeChanged"
|
SelectedDataItemChanged="@OnSelectedEnvelopeChanged"
|
||||||
CustomizeElement="OnCustomizeElement">
|
CustomizeElement="OnCustomizeElement">
|
||||||
<Columns>
|
<Columns>
|
||||||
<DxGridDataColumn FieldName="Id" Caption="ID">
|
<DxGridDataColumn FieldName="Id" Caption="ID"
|
||||||
|
SortIndex="0"
|
||||||
|
SortOrder="GridColumnSortOrder.Descending">
|
||||||
<CellDisplayTemplate Context="cellContext">
|
<CellDisplayTemplate Context="cellContext">
|
||||||
@((cellContext.DataItem as EnvelopeDto)?.Id)
|
@((cellContext.DataItem as EnvelopeDto)?.Id)
|
||||||
</CellDisplayTemplate>
|
</CellDisplayTemplate>
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
|
|
||||||
if (result == EnvelopeLoginResult.Success)
|
if (result == EnvelopeLoginResult.Success)
|
||||||
{
|
{
|
||||||
Navigation.NavigateTo($"/envelope/{Uri.EscapeDataString(EnvelopeKey)}/report", forceLoad: true);
|
Navigation.NavigateTo($"/envelope/{Uri.EscapeDataString(EnvelopeKey)}", forceLoad: true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using System.Net;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands;
|
||||||
using EnvelopeGenerator.Server.Client.Models;
|
using EnvelopeGenerator.Server.Client.Models;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Server.Client.Services;
|
namespace EnvelopeGenerator.Server.Client.Services;
|
||||||
@@ -9,6 +10,7 @@ namespace EnvelopeGenerator.Server.Client.Services;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the <see cref="EnvelopeReceiverDto"/> for the authenticated receiver
|
/// Retrieves the <see cref="EnvelopeReceiverDto"/> for the authenticated receiver
|
||||||
/// from <c>GET /api/EnvelopeReceiver/{envelopeKey}</c>.
|
/// from <c>GET /api/EnvelopeReceiver/{envelopeKey}</c>.
|
||||||
|
/// Also creates new envelopes via <c>POST /api/EnvelopeReceiver</c>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class EnvelopeReceiverService(IHttpClientFactory httpClientFactory)
|
public class EnvelopeReceiverService(IHttpClientFactory httpClientFactory)
|
||||||
{
|
{
|
||||||
@@ -37,4 +39,28 @@ public class EnvelopeReceiverService(IHttpClientFactory httpClientFactory)
|
|||||||
|
|
||||||
return await response.Content.ReadFromJsonAsync<EnvelopeReceiverDto>(_jsonOptions, cancel);
|
return await response.Content.ReadFromJsonAsync<EnvelopeReceiverDto>(_jsonOptions, cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new envelope with document and receivers via <c>POST /api/EnvelopeReceiver</c>.
|
||||||
|
/// Requires sender authentication cookie to be present in the request.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="HttpRequestException">Thrown when the API request fails.</exception>
|
||||||
|
public async Task<CreateEnvelopeReceiverResponse?> CreateAsync(
|
||||||
|
CreateEnvelopeReceiverCommand request,
|
||||||
|
CancellationToken cancel = default)
|
||||||
|
{
|
||||||
|
using var http = httpClientFactory.CreateClient("EnvelopeGenerator.Server");
|
||||||
|
var response = await http.PostAsJsonAsync("/api/EnvelopeReceiver", request, _jsonOptions, cancel);
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var body = await response.Content.ReadAsStringAsync(cancel);
|
||||||
|
throw new HttpRequestException(
|
||||||
|
$"Fehler beim Erstellen des Umschlags. Status: {(int)response.StatusCode} – {body}",
|
||||||
|
null,
|
||||||
|
response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await response.Content.ReadFromJsonAsync<CreateEnvelopeReceiverResponse>(_jsonOptions, cancel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
@using DevExpress.Blazor.PdfViewer
|
@using DevExpress.Blazor.PdfViewer
|
||||||
@using DevExpress.Blazor.Reporting.Models
|
@using DevExpress.Blazor.Reporting.Models
|
||||||
@using DevExpress.Blazor
|
@using DevExpress.Blazor
|
||||||
|
@using EnvelopeGenerator.Application.EnvelopeReceivers.Commands
|
||||||
@using EnvelopeGenerator.Server.Client.Services
|
@using EnvelopeGenerator.Server.Client.Services
|
||||||
@using EnvelopeGenerator.Server.Services
|
@using EnvelopeGenerator.Server.Services
|
||||||
@using Microsoft.AspNetCore.Components.Forms
|
@using Microsoft.AspNetCore.Components.Forms
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
@inject AppVersionService AppVersion
|
@inject AppVersionService AppVersion
|
||||||
@inject ILogger<EnvelopeSenderEditorPage> Logger
|
@inject ILogger<EnvelopeSenderEditorPage> Logger
|
||||||
@inject EnvelopeReceiverPageDataService ReceiverPageDataService
|
@inject EnvelopeReceiverPageDataService ReceiverPageDataService
|
||||||
|
@inject EnvelopeReceiverService EnvelopeReceiverService
|
||||||
@inject IMemoryCache MemoryCache
|
@inject IMemoryCache MemoryCache
|
||||||
|
|
||||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||||
@@ -26,23 +28,65 @@
|
|||||||
<div class="envelope-action-bar__inner"
|
<div class="envelope-action-bar__inner"
|
||||||
style="flex-direction: row; align-items: center; padding: 0.35rem 1.5rem; gap: 0.75rem;">
|
style="flex-direction: row; align-items: center; padding: 0.35rem 1.5rem; gap: 0.75rem;">
|
||||||
|
|
||||||
@* Left: Title *@
|
@* Left: Title + meta inputs + receivers *@
|
||||||
<div style="flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0.75rem;">
|
<div style="flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0.5rem;">
|
||||||
<div style="display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex-wrap: wrap;">
|
|
||||||
<div style="font-size: 0.9rem; font-weight: 600; color: #1f2937; white-space: nowrap;">
|
@* ── Title & Message inputs ── *@
|
||||||
Neues Dokument
|
<div style="display: flex; align-items: flex-start; gap: 0.5rem; flex-wrap: wrap;">
|
||||||
|
|
||||||
|
@* Titel *@
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 180px; min-width: 140px;">
|
||||||
|
<label style="font-size: 0.65rem; font-weight: 600; color: #6b7280;
|
||||||
|
text-transform: uppercase; letter-spacing: 0.05em;">
|
||||||
|
Titel <span style="color:#dc2626;">*</span>
|
||||||
|
</label>
|
||||||
|
<input type="text"
|
||||||
|
value="@_envelopeTitle"
|
||||||
|
@oninput="e => _envelopeTitle = e.Value?.ToString() ?? string.Empty"
|
||||||
|
placeholder="z.B. Arbeitsvertrag 2025"
|
||||||
|
maxlength="120"
|
||||||
|
style="font-size: 0.78rem; font-weight: 500; color: #1f2937;
|
||||||
|
border: 1px solid #d1d5db; border-radius: 5px;
|
||||||
|
padding: 0.3rem 0.55rem; outline: none; width: 100%;
|
||||||
|
background: #fff;
|
||||||
|
@(_titleTouched && string.IsNullOrWhiteSpace(_envelopeTitle) ? "border-color:#dc2626;" : "")" />
|
||||||
|
@if (_titleTouched && string.IsNullOrWhiteSpace(_envelopeTitle))
|
||||||
|
{
|
||||||
|
<span style="font-size:0.6rem;color:#dc2626;">Pflichtfeld</span>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@* Nachricht *@
|
||||||
|
<div style="display: flex; flex-direction: column; gap: 0.2rem; flex: 2 1 260px; min-width: 180px;">
|
||||||
|
<label style="font-size: 0.65rem; font-weight: 600; color: #6b7280;
|
||||||
|
text-transform: uppercase; letter-spacing: 0.05em;">
|
||||||
|
Nachricht <span style="color:#6b7280;font-weight:400;">(optional)</span>
|
||||||
|
</label>
|
||||||
|
<input type="text"
|
||||||
|
value="@_envelopeMessage"
|
||||||
|
@oninput="e => _envelopeMessage = e.Value?.ToString() ?? string.Empty"
|
||||||
|
placeholder="Bitte unterzeichnen Sie das beigefügte Dokument."
|
||||||
|
maxlength="500"
|
||||||
|
style="font-size: 0.78rem; color: #1f2937;
|
||||||
|
border: 1px solid #d1d5db; border-radius: 5px;
|
||||||
|
padding: 0.3rem 0.55rem; outline: none; width: 100%;
|
||||||
|
background: #fff;" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@* PDF filename badge *@
|
||||||
@if (_pdfLoaded)
|
@if (_pdfLoaded)
|
||||||
{
|
{
|
||||||
<span style="font-size: 0.7rem; color: #6b7280;">@_fileName</span>
|
<div style="display:flex;align-items:flex-end;gap:0.4rem;padding-bottom:0.05rem;flex-shrink:0;">
|
||||||
@if (_signatureFields.Count > 0)
|
<span style="font-size: 0.7rem; color: #6b7280;">@_fileName</span>
|
||||||
{
|
@if (_signatureFields.Count > 0)
|
||||||
<span style="display: inline-flex; align-items: center; padding: 0.125rem 0.4rem;
|
{
|
||||||
background: #ede9fe; border-radius: 0.25rem; color: #6d28d9;
|
<span style="display: inline-flex; align-items: center; padding: 0.125rem 0.4rem;
|
||||||
font-weight: 500; font-size: 0.7rem; white-space: nowrap;">
|
background: #ede9fe; border-radius: 0.25rem; color: #6d28d9;
|
||||||
@_signatureFields.Count Signaturfeld@(_signatureFields.Count != 1 ? "er" : "")
|
font-weight: 500; font-size: 0.7rem; white-space: nowrap;">
|
||||||
</span>
|
@_signatureFields.Count Signaturfeld@(_signatureFields.Count != 1 ? "er" : "")
|
||||||
}
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -74,7 +118,8 @@
|
|||||||
<div class="sender-receivers-list">
|
<div class="sender-receivers-list">
|
||||||
@foreach (var receiver in _receivers)
|
@foreach (var receiver in _receivers)
|
||||||
{
|
{
|
||||||
<div class="sender-receiver-chip">
|
<div class="sender-receiver-chip"
|
||||||
|
style="border-left: 3px solid @receiver.Color;">
|
||||||
<div class="sender-receiver-chip__body">
|
<div class="sender-receiver-chip__body">
|
||||||
<div class="sender-receiver-chip__name">@receiver.FullName</div>
|
<div class="sender-receiver-chip__name">@receiver.FullName</div>
|
||||||
<div class="sender-receiver-chip__email">@receiver.Email</div>
|
<div class="sender-receiver-chip__email">@receiver.Email</div>
|
||||||
@@ -87,6 +132,7 @@
|
|||||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-change sender-toolbar-action-btn sender-toolbar-action-btn--compact
|
<button class="pdf-toolbar__btn pdf-toolbar__btn--signature-change sender-toolbar-action-btn sender-toolbar-action-btn--compact
|
||||||
@(_pendingReceiverForPlacement?.Id == receiver.Id ? "pdf-toolbar__btn--signature-change-active" : "")"
|
@(_pendingReceiverForPlacement?.Id == receiver.Id ? "pdf-toolbar__btn--signature-change-active" : "")"
|
||||||
@onclick="() => ActivatePlacementForReceiver(receiver)"
|
@onclick="() => ActivatePlacementForReceiver(receiver)"
|
||||||
|
style="@(_pendingReceiverForPlacement?.Id == receiver.Id ? $"background:{receiver.Color};color:#fff;border-color:{receiver.Color};" : $"color:{receiver.Color};border-color:{receiver.Color};")"
|
||||||
title="Signaturfeld platzieren">
|
title="Signaturfeld platzieren">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
||||||
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10z" />
|
<path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10z" />
|
||||||
@@ -141,11 +187,20 @@
|
|||||||
@* Save *@
|
@* Save *@
|
||||||
<button class="pdf-toolbar__btn pdf-toolbar__btn--success"
|
<button class="pdf-toolbar__btn pdf-toolbar__btn--success"
|
||||||
@onclick="SaveAsync"
|
@onclick="SaveAsync"
|
||||||
|
disabled="@_isSaving"
|
||||||
title="Speichern"
|
title="Speichern"
|
||||||
style="background: linear-gradient(135deg,#059669,#047857); color:#fff; border-radius:6px; padding:0.3rem 0.75rem; font-size:0.75rem; font-weight:600; border:none;">
|
style="background: linear-gradient(135deg,#059669,#047857); color:#fff; border-radius:6px; padding:0.3rem 0.75rem; font-size:0.75rem; font-weight:600; border:none;">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
@if (_isSaving)
|
||||||
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" />
|
{
|
||||||
</svg>
|
<span class="spinner-border spinner-border-sm me-1" role="status"
|
||||||
|
style="width:0.8rem;height:0.8rem;border-width:2px;"></span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" class="me-1" viewBox="0 0 16 16">
|
||||||
|
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z" />
|
||||||
|
</svg>
|
||||||
|
}
|
||||||
Speichern
|
Speichern
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
@@ -155,7 +210,7 @@
|
|||||||
@* Placement mode hint bar *@
|
@* Placement mode hint bar *@
|
||||||
@if (_pendingReceiverForPlacement is not null)
|
@if (_pendingReceiverForPlacement is not null)
|
||||||
{
|
{
|
||||||
<div style="background: #4F46E5; color: white; font-size: 0.75rem; font-weight: 500;
|
<div style="background: @_pendingReceiverForPlacement.Color; color: white; font-size: 0.75rem; font-weight: 500;
|
||||||
padding: 0.3rem 1.5rem; text-align: center; letter-spacing: 0.01em;">
|
padding: 0.3rem 1.5rem; text-align: center; letter-spacing: 0.01em;">
|
||||||
📌 Klicken Sie auf die Stelle im Dokument für <strong>@_pendingReceiverForPlacement.FullName</strong>.
|
📌 Klicken Sie auf die Stelle im Dokument für <strong>@_pendingReceiverForPlacement.FullName</strong>.
|
||||||
<button @onclick="CancelPlacement"
|
<button @onclick="CancelPlacement"
|
||||||
@@ -301,6 +356,79 @@
|
|||||||
</FooterContentTemplate>
|
</FooterContentTemplate>
|
||||||
</DxPopup>
|
</DxPopup>
|
||||||
|
|
||||||
|
@* ── Save result popup (success + error) ── *@
|
||||||
|
<DxPopup @bind-Visible="_savePopupVisible"
|
||||||
|
HeaderText="@(_saveErrorMessage is null ? "Umschlag erstellt" : "Fehler")"
|
||||||
|
Width="460px"
|
||||||
|
MaxWidth="95vw"
|
||||||
|
ShowFooter="true"
|
||||||
|
CloseOnOutsideClick="false"
|
||||||
|
ShowCloseButton="false"
|
||||||
|
CloseOnEscape="false">
|
||||||
|
<BodyContentTemplate>
|
||||||
|
@if (_saveErrorMessage is null)
|
||||||
|
{
|
||||||
|
<div style="display:flex;align-items:flex-start;gap:1rem;padding:0.5rem 0;">
|
||||||
|
<div style="flex-shrink:0;width:40px;height:40px;background:#d1fae5;border-radius:50%;
|
||||||
|
display:flex;align-items:center;justify-content:center;">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#065f46" viewBox="0 0 16 16">
|
||||||
|
<path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p style="margin:0 0 0.4rem;font-weight:600;color:#1f2937;font-size:0.95rem;">
|
||||||
|
Umschlag wurde erfolgreich erstellt.
|
||||||
|
</p>
|
||||||
|
<p style="margin:0;color:#6b7280;font-size:0.85rem;line-height:1.5;">
|
||||||
|
Der Umschlag wurde gespeichert und die Empfänger wurden benachrichtigt.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div style="display:flex;align-items:flex-start;gap:1rem;padding:0.5rem 0;">
|
||||||
|
<div style="flex-shrink:0;width:40px;height:40px;background:#fee2e2;border-radius:50%;
|
||||||
|
display:flex;align-items:center;justify-content:center;">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#991b1b" viewBox="0 0 16 16">
|
||||||
|
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
|
||||||
|
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p style="margin:0 0 0.4rem;font-weight:600;color:#1f2937;font-size:0.95rem;">
|
||||||
|
Fehler beim Erstellen des Umschlags
|
||||||
|
</p>
|
||||||
|
<p style="margin:0;color:#6b7280;font-size:0.85rem;line-height:1.5;word-break:break-word;">
|
||||||
|
@_saveErrorMessage
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</BodyContentTemplate>
|
||||||
|
<FooterContentTemplate>
|
||||||
|
<div style="display:flex;gap:0.5rem;justify-content:flex-end;width:100%;padding:0.5rem 0;">
|
||||||
|
@if (_saveErrorMessage is null)
|
||||||
|
{
|
||||||
|
<button class="btn btn-primary"
|
||||||
|
@onclick="GoToDashboard"
|
||||||
|
style="background:linear-gradient(135deg,#059669,#047857);border:none;border-radius:6px;
|
||||||
|
padding:0.5rem 1.5rem;font-weight:600;color:#fff;">
|
||||||
|
Zur Übersicht
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<button class="btn btn-outline-secondary"
|
||||||
|
@onclick="() => _savePopupVisible = false"
|
||||||
|
style="border-radius:6px;padding:0.5rem 1.25rem;font-weight:500;">
|
||||||
|
Schließen
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</FooterContentTemplate>
|
||||||
|
</DxPopup>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
// ── Session query param — persists across SignalR reconnects ──
|
// ── Session query param — persists across SignalR reconnects ──
|
||||||
[SupplyParameterFromQuery(Name = "esid")]
|
[SupplyParameterFromQuery(Name = "esid")]
|
||||||
@@ -328,6 +456,16 @@
|
|||||||
List<SignatureFieldDraft> _signatureFields = [];
|
List<SignatureFieldDraft> _signatureFields = [];
|
||||||
ReceiverDraft? _pendingReceiverForPlacement; // Set when user clicks "Signatur hinzufügen"
|
ReceiverDraft? _pendingReceiverForPlacement; // Set when user clicks "Signatur hinzufügen"
|
||||||
|
|
||||||
|
// ── Save state ──
|
||||||
|
bool _isSaving = false;
|
||||||
|
bool _savePopupVisible = false;
|
||||||
|
string? _saveErrorMessage = null;
|
||||||
|
|
||||||
|
// ── Envelope metadata ──
|
||||||
|
string _envelopeTitle = string.Empty;
|
||||||
|
string _envelopeMessage = string.Empty;
|
||||||
|
bool _titleTouched = false;
|
||||||
|
|
||||||
List<ReceiverDraft> _receivers = [];
|
List<ReceiverDraft> _receivers = [];
|
||||||
bool _receiverPopupVisible;
|
bool _receiverPopupVisible;
|
||||||
string _receiverDraftName = string.Empty;
|
string _receiverDraftName = string.Empty;
|
||||||
@@ -348,8 +486,17 @@
|
|||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
// If no session id exists yet, generate one and redirect so it sticks in the URL.
|
// Intentionally empty.
|
||||||
// This is the ONLY navigation that uses forceLoad; afterwards the page lives forever.
|
// esid redirect is done in OnAfterRenderAsync to avoid NavigationException
|
||||||
|
// during SSR prerendering, where NavigateTo throws by design.
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
{
|
||||||
|
if (!firstRender) return;
|
||||||
|
|
||||||
|
// Generate a session id on first interactive render and push it into the URL.
|
||||||
|
// At this point SignalR is connected and NavigateTo is safe.
|
||||||
if (string.IsNullOrWhiteSpace(Esid))
|
if (string.IsNullOrWhiteSpace(Esid))
|
||||||
{
|
{
|
||||||
var sid = Guid.NewGuid().ToString("N");
|
var sid = Guid.NewGuid().ToString("N");
|
||||||
@@ -369,6 +516,8 @@
|
|||||||
_fileName = cached.FileName;
|
_fileName = cached.FileName;
|
||||||
_pdfLoaded = _originalPdfBytes is { Length: > 0 };
|
_pdfLoaded = _originalPdfBytes is { Length: > 0 };
|
||||||
_receivers = cached.Receivers;
|
_receivers = cached.Receivers;
|
||||||
|
_envelopeTitle = cached.Title;
|
||||||
|
_envelopeMessage = cached.Message;
|
||||||
|
|
||||||
// Redraw placeholders onto the original PDF
|
// Redraw placeholders onto the original PDF
|
||||||
if (_pdfLoaded)
|
if (_pdfLoaded)
|
||||||
@@ -474,7 +623,8 @@
|
|||||||
XPt: xPt,
|
XPt: xPt,
|
||||||
YPt: yPt,
|
YPt: yPt,
|
||||||
Page: page1Based,
|
Page: page1Based,
|
||||||
ReceiverName: _pendingReceiverForPlacement.FullName);
|
ReceiverName: _pendingReceiverForPlacement.FullName,
|
||||||
|
Color: _pendingReceiverForPlacement.Color);
|
||||||
|
|
||||||
_signatureFields.Add(field);
|
_signatureFields.Add(field);
|
||||||
_pendingReceiverForPlacement = null;
|
_pendingReceiverForPlacement = null;
|
||||||
@@ -511,24 +661,120 @@
|
|||||||
|
|
||||||
void Cancel() => NavigationManager.NavigateTo("/sender");
|
void Cancel() => NavigationManager.NavigateTo("/sender");
|
||||||
|
|
||||||
// ── Save ──
|
void GoToDashboard()
|
||||||
|
{
|
||||||
|
// Clear session from cache on successful save so it is not restored if user returns
|
||||||
|
if (!string.IsNullOrWhiteSpace(Esid))
|
||||||
|
MemoryCache.Remove(SessionKey);
|
||||||
|
|
||||||
|
NavigationManager.NavigateTo("/sender");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Save — POST /api/EnvelopeReceiver ──
|
||||||
async Task SaveAsync()
|
async Task SaveAsync()
|
||||||
{
|
{
|
||||||
|
// ── Validation ──
|
||||||
|
_titleTouched = true;
|
||||||
|
if (!_pdfLoaded || _originalPdfBytes is null)
|
||||||
|
{
|
||||||
|
_saveErrorMessage = "Bitte laden Sie zuerst ein PDF-Dokument hoch.";
|
||||||
|
_savePopupVisible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(_envelopeTitle))
|
||||||
|
{
|
||||||
|
_saveErrorMessage = "Bitte geben Sie einen Titel ein.";
|
||||||
|
_savePopupVisible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (_receivers.Count == 0)
|
||||||
|
{
|
||||||
|
_saveErrorMessage = "Bitte fügen Sie mindestens einen Empfänger hinzu.";
|
||||||
|
_savePopupVisible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (_signatureFields.Count == 0)
|
if (_signatureFields.Count == 0)
|
||||||
{
|
{
|
||||||
await JSRuntime.InvokeVoidAsync("console.log",
|
_saveErrorMessage = "Bitte platzieren Sie mindestens ein Signaturfeld.";
|
||||||
"[SenderEditor] No signature fields to save.");
|
_savePopupVisible = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var f in _signatureFields)
|
// Warn if any receiver has no signature field, but don't block
|
||||||
|
var receiversWithoutField = _receivers
|
||||||
|
.Where(r => !_signatureFields.Any(f => f.ReceiverName == r.FullName))
|
||||||
|
.ToList();
|
||||||
|
if (receiversWithoutField.Count > 0)
|
||||||
{
|
{
|
||||||
await JSRuntime.InvokeVoidAsync("console.log",
|
Logger.LogWarning(
|
||||||
$"[SenderEditor] Field: Page={f.Page} X={f.XPt:F2}pt ({f.XPt / 72:F3}in) Y={f.YPt:F2}pt ({f.YPt / 72:F3}in) Receiver={f.ReceiverName}");
|
"[SenderEditor] Receivers without signature field: {Names}",
|
||||||
|
string.Join(", ", receiversWithoutField.Select(r => r.FullName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
await JSRuntime.InvokeVoidAsync("console.log",
|
_isSaving = true;
|
||||||
$"[SenderEditor] Total fields: {_signatureFields.Count}");
|
_saveErrorMessage = null;
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// ── Build request ──
|
||||||
|
// Document: use the ORIGINAL pdf (without placeholder burn-in) as base64
|
||||||
|
var docBase64 = Convert.ToBase64String(_originalPdfBytes);
|
||||||
|
|
||||||
|
// Build receivers list — each receiver gets their own signature fields
|
||||||
|
// Coordinate conversion: PDF points → inches (DB stores inches)
|
||||||
|
var receiversCmd = _receivers.Select(receiver =>
|
||||||
|
{
|
||||||
|
var fields = _signatureFields
|
||||||
|
.Where(f => f.ReceiverName == receiver.FullName)
|
||||||
|
.Select(f => new DocReceiverElementCreateDto(
|
||||||
|
X: f.XPt / 72.0,
|
||||||
|
Y: f.YPt / 72.0,
|
||||||
|
Page: f.Page))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return new ReceiverGetOrCreateCommand
|
||||||
|
{
|
||||||
|
EmailAddress = receiver.Email,
|
||||||
|
Salution = receiver.FullName,
|
||||||
|
PhoneNumber = string.IsNullOrWhiteSpace(receiver.PhoneNumber)
|
||||||
|
? null
|
||||||
|
: receiver.PhoneNumber,
|
||||||
|
DocReceiverElements = fields,
|
||||||
|
};
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
var command = new CreateEnvelopeReceiverCommand
|
||||||
|
{
|
||||||
|
Title = _envelopeTitle.Trim(),
|
||||||
|
Message = string.IsNullOrWhiteSpace(_envelopeMessage)
|
||||||
|
? "Bitte unterzeichnen Sie das beigefügte Dokument."
|
||||||
|
: _envelopeMessage.Trim(),
|
||||||
|
TFAEnabled = false,
|
||||||
|
Document = new DocumentCreateCommand { DataAsBase64 = docBase64 },
|
||||||
|
Receivers = receiversCmd,
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await EnvelopeReceiverService.CreateAsync(command);
|
||||||
|
|
||||||
|
Logger.LogInformation(
|
||||||
|
"[SenderEditor] Envelope created. Id={Id} SentReceivers={Count}",
|
||||||
|
result?.Id, result?.SentReceiver.Count());
|
||||||
|
|
||||||
|
// Success — show popup; GoToDashboard clears cache and navigates
|
||||||
|
_saveErrorMessage = null;
|
||||||
|
_savePopupVisible = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError(ex, "[SenderEditor] Failed to create envelope");
|
||||||
|
_saveErrorMessage = ex.Message;
|
||||||
|
_savePopupVisible = true;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isSaving = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Cache persistence ──
|
// ── Cache persistence ──
|
||||||
@@ -540,7 +786,9 @@
|
|||||||
OriginalPdfBytes: _originalPdfBytes ?? [],
|
OriginalPdfBytes: _originalPdfBytes ?? [],
|
||||||
Fields: [.. _signatureFields],
|
Fields: [.. _signatureFields],
|
||||||
FileName: _fileName,
|
FileName: _fileName,
|
||||||
Receivers: [.. _receivers]);
|
Receivers: [.. _receivers],
|
||||||
|
Title: _envelopeTitle,
|
||||||
|
Message: _envelopeMessage);
|
||||||
|
|
||||||
MemoryCache.Set(SessionKey, data, SessionTtl);
|
MemoryCache.Set(SessionKey, data, SessionTtl);
|
||||||
}
|
}
|
||||||
@@ -556,25 +804,6 @@
|
|||||||
var document = PdfSharp.Pdf.IO.PdfReader.Open(
|
var document = PdfSharp.Pdf.IO.PdfReader.Open(
|
||||||
inputMs, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify);
|
inputMs, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify);
|
||||||
|
|
||||||
// Visual style — same palette as the receiver-side placeholder
|
|
||||||
var fillBrush = new PdfSharp.Drawing.XSolidBrush(PdfSharp.Drawing.XColor.FromArgb( 40, 60, 80, 160));
|
|
||||||
var borderPen = new PdfSharp.Drawing.XPen(PdfSharp.Drawing.XColor.FromArgb(200, 60, 80, 200), 1.5);
|
|
||||||
var textBrush = new PdfSharp.Drawing.XSolidBrush(PdfSharp.Drawing.XColor.FromArgb(200, 40, 60, 140));
|
|
||||||
var nameBrush = new PdfSharp.Drawing.XSolidBrush(PdfSharp.Drawing.XColor.FromArgb(255, 30, 30, 100));
|
|
||||||
var fontLabel = new PdfSharp.Drawing.XFont("Arial", 9, PdfSharp.Drawing.XFontStyleEx.Bold);
|
|
||||||
var fontName = new PdfSharp.Drawing.XFont("Arial", 7, PdfSharp.Drawing.XFontStyleEx.Regular);
|
|
||||||
|
|
||||||
var fmtCenter = new PdfSharp.Drawing.XStringFormat
|
|
||||||
{
|
|
||||||
Alignment = PdfSharp.Drawing.XStringAlignment.Center,
|
|
||||||
LineAlignment = PdfSharp.Drawing.XLineAlignment.Center,
|
|
||||||
};
|
|
||||||
var fmtBottomCenter = new PdfSharp.Drawing.XStringFormat
|
|
||||||
{
|
|
||||||
Alignment = PdfSharp.Drawing.XStringAlignment.Center,
|
|
||||||
LineAlignment = PdfSharp.Drawing.XLineAlignment.Far,
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var field in fields)
|
foreach (var field in fields)
|
||||||
{
|
{
|
||||||
int pageIndex = field.Page - 1;
|
int pageIndex = field.Page - 1;
|
||||||
@@ -583,6 +812,21 @@
|
|||||||
var page = document.Pages[pageIndex];
|
var page = document.Pages[pageIndex];
|
||||||
using var gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(page);
|
using var gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(page);
|
||||||
|
|
||||||
|
// Derive colours from the receiver's hex colour
|
||||||
|
var fillBrush = new PdfSharp.Drawing.XSolidBrush(HexToXColor(field.Color, alpha: 35));
|
||||||
|
var borderPen = new PdfSharp.Drawing.XPen(HexToXColor(field.Color, alpha: 210), 1.5);
|
||||||
|
var textBrush = new PdfSharp.Drawing.XSolidBrush(HexToXColor(field.Color, alpha: 200));
|
||||||
|
var nameBrush = new PdfSharp.Drawing.XSolidBrush(HexToXColor(field.Color, alpha: 230));
|
||||||
|
|
||||||
|
var fontLabel = new PdfSharp.Drawing.XFont("Arial", 9, PdfSharp.Drawing.XFontStyleEx.Bold);
|
||||||
|
var fontName = new PdfSharp.Drawing.XFont("Arial", 7, PdfSharp.Drawing.XFontStyleEx.Regular);
|
||||||
|
|
||||||
|
var fmtCenter = new PdfSharp.Drawing.XStringFormat
|
||||||
|
{
|
||||||
|
Alignment = PdfSharp.Drawing.XStringAlignment.Center,
|
||||||
|
LineAlignment = PdfSharp.Drawing.XLineAlignment.Center,
|
||||||
|
};
|
||||||
|
|
||||||
var rect = new PdfSharp.Drawing.XRect(field.XPt, field.YPt, SigWidthPt, SigHeightPt);
|
var rect = new PdfSharp.Drawing.XRect(field.XPt, field.YPt, SigWidthPt, SigHeightPt);
|
||||||
|
|
||||||
gfx.DrawRectangle(fillBrush, rect);
|
gfx.DrawRectangle(fillBrush, rect);
|
||||||
@@ -607,6 +851,13 @@
|
|||||||
return outputMs.ToArray();
|
return outputMs.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Converts a CSS hex colour string (e.g. "#4F46E5") to a PdfSharp XColor.</summary>
|
||||||
|
static PdfSharp.Drawing.XColor HexToXColor(string hex, int alpha)
|
||||||
|
{
|
||||||
|
var c = System.Drawing.ColorTranslator.FromHtml(hex);
|
||||||
|
return PdfSharp.Drawing.XColor.FromArgb(alpha, c.R, c.G, c.B);
|
||||||
|
}
|
||||||
|
|
||||||
// ── Receiver popup ──
|
// ── Receiver popup ──
|
||||||
void OpenAddReceiverPopup()
|
void OpenAddReceiverPopup()
|
||||||
{
|
{
|
||||||
@@ -768,22 +1019,38 @@
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
_receivers.Add(new ReceiverDraft(Guid.NewGuid(), fullName, email, phoneNumber));
|
_receivers.Add(new ReceiverDraft(Guid.NewGuid(), fullName, email, phoneNumber,
|
||||||
|
ReceiverPalette[_receivers.Count % ReceiverPalette.Length]));
|
||||||
PersistSession();
|
PersistSession();
|
||||||
CloseAddReceiverPopup();
|
CloseAddReceiverPopup();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Models ──
|
// ── Models ──
|
||||||
record SignatureFieldDraft(double XPt, double YPt, int Page, string ReceiverName);
|
record SignatureFieldDraft(double XPt, double YPt, int Page, string ReceiverName, string Color);
|
||||||
|
|
||||||
record NormalisedCoords(double NormX, double NormY, int PageIndex);
|
record NormalisedCoords(double NormX, double NormY, int PageIndex);
|
||||||
|
|
||||||
record ReceiverDraft(Guid Id, string FullName, string Email, string PhoneNumber);
|
record ReceiverDraft(Guid Id, string FullName, string Email, string PhoneNumber, string Color);
|
||||||
|
|
||||||
record EditorSessionData(
|
record EditorSessionData(
|
||||||
byte[] OriginalPdfBytes,
|
byte[] OriginalPdfBytes,
|
||||||
List<SignatureFieldDraft> Fields,
|
List<SignatureFieldDraft> Fields,
|
||||||
string FileName,
|
string FileName,
|
||||||
List<ReceiverDraft> Receivers);
|
List<ReceiverDraft> Receivers,
|
||||||
|
string Title,
|
||||||
|
string Message);
|
||||||
|
|
||||||
|
// ── Receiver colour palette (cycles when > 8 receivers) ──
|
||||||
|
static readonly string[] ReceiverPalette =
|
||||||
|
[
|
||||||
|
"#4F46E5", // indigo
|
||||||
|
"#059669", // emerald
|
||||||
|
"#DC2626", // red
|
||||||
|
"#D97706", // amber
|
||||||
|
"#7C3AED", // violet
|
||||||
|
"#0891B2", // cyan
|
||||||
|
"#BE185D", // pink
|
||||||
|
"#65A30D", // lime
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@page "/envelope/{EnvelopeKey}/report"
|
@page "/envelope/{EnvelopeKey}"
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
@using DevExpress.Blazor.Reporting
|
@using DevExpress.Blazor.Reporting
|
||||||
@using DevExpress.XtraReports.UI
|
@using DevExpress.XtraReports.UI
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverPageDataService PageDataService
|
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverPageDataService PageDataService
|
||||||
@inject AppVersionService AppVersion
|
@inject AppVersionService AppVersion
|
||||||
@inject IMemoryCache MemoryCache
|
@inject IMemoryCache MemoryCache
|
||||||
@inject ILogger<EnvelopeReceiverReportPage> Logger
|
@inject ILogger<ReceiverPage> Logger
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
||||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverPageDataService PageDataService
|
@inject EnvelopeGenerator.Server.Services.EnvelopeReceiverPageDataService PageDataService
|
||||||
@inject AppVersionService AppVersion
|
@inject AppVersionService AppVersion
|
||||||
@inject IMemoryCache MemoryCache
|
@inject IMemoryCache MemoryCache
|
||||||
@inject ILogger<EnvelopeReceiverReportSignedPage> Logger
|
@inject ILogger<ReceiverSignedPage> Logger
|
||||||
@implements IDisposable
|
@implements IDisposable
|
||||||
|
|
||||||
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
<link href="_content/DevExpress.Blazor.Themes/blazing-berry.bs5.min.css" rel="stylesheet" />
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
"[SignedPage] Cache miss or no sid={Sid} for {EnvelopeKey}, redirecting to report page.",
|
"[SignedPage] Cache miss or no sid={Sid} for {EnvelopeKey}, redirecting to report page.",
|
||||||
Sid, EnvelopeKey);
|
Sid, EnvelopeKey);
|
||||||
Navigation.NavigateTo(
|
Navigation.NavigateTo(
|
||||||
$"/envelope/{Uri.EscapeDataString(EnvelopeKey)}/report",
|
$"/envelope/{Uri.EscapeDataString(EnvelopeKey)}",
|
||||||
forceLoad: true);
|
forceLoad: true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@page "/envelope/{EnvelopeKey}"
|
@page "/envelope/{EnvelopeKey}/deprc"
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
@using EnvelopeGenerator.Server.Client.Models
|
@using EnvelopeGenerator.Server.Client.Models
|
||||||
@using EnvelopeGenerator.Server.Client.Models.Constants
|
@using EnvelopeGenerator.Server.Client.Models.Constants
|
||||||
@@ -40,7 +40,7 @@ public partial class AuthController(IOptions<AuthTokenKeys> authTokenKeyOptions,
|
|||||||
/// <response code="401">Wenn es kein zugelassenes Cookie gibt, wird „nicht zugelassen“ zurückgegeben.</response>
|
/// <response code="401">Wenn es kein zugelassenes Cookie gibt, wird „nicht zugelassen“ zurückgegeben.</response>
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||||
[Authorize(Policy = AuthPolicy.Sender)]
|
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||||
[HttpPost("logout")]
|
[HttpPost("logout")]
|
||||||
public IActionResult Logout()
|
public IActionResult Logout()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class DocumentController(IMediator mediator, IAuthorizationService authSe
|
|||||||
/// <param name="query">Encoded envelope key.</param>
|
/// <param name="query">Encoded envelope key.</param>
|
||||||
/// <param name="cancel">Cancellation token.</param>
|
/// <param name="cancel">Cancellation token.</param>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize(Policy = AuthPolicy.Sender)]
|
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||||
public async Task<IActionResult> GetDocument(CancellationToken cancel, [FromQuery] ReadDocumentQuery? query = null)
|
public async Task<IActionResult> GetDocument(CancellationToken cancel, [FromQuery] ReadDocumentQuery? query = null)
|
||||||
{
|
{
|
||||||
if (query is null)
|
if (query is null)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace EnvelopeGenerator.Server.Controllers;
|
|||||||
/// </param>
|
/// </param>
|
||||||
[Route("api/[controller]")]
|
[Route("api/[controller]")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Authorize(Policy = AuthPolicy.Sender)]
|
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||||
public class EmailTemplateController(IMediator mediator) : ControllerBase
|
public class EmailTemplateController(IMediator mediator) : ControllerBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
/// <response code="400">Wenn ein Fehler im HTTP-Body auftritt</response>
|
/// <response code="400">Wenn ein Fehler im HTTP-Body auftritt</response>
|
||||||
/// <response code="401">Wenn kein autorisierter Token vorhanden ist</response>
|
/// <response code="401">Wenn kein autorisierter Token vorhanden ist</response>
|
||||||
/// <response code="500">Es handelt sich um einen unerwarteten Fehler. Die Protokolle sollten überprüft werden.</response>
|
/// <response code="500">Es handelt sich um einen unerwarteten Fehler. Die Protokolle sollten überprüft werden.</response>
|
||||||
[Authorize]
|
[Authorize(AuthenticationSchemes = AuthScheme.Sender)]
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> CreateAsync([FromBody] CreateEnvelopeReceiverCommand request, CancellationToken cancel)
|
public async Task<IActionResult> CreateAsync([FromBody] CreateEnvelopeReceiverCommand request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
@@ -214,6 +214,10 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
bool outSuccess = reader.GetBoolean(0);
|
bool outSuccess = reader.GetBoolean(0);
|
||||||
|
if (!outSuccess)
|
||||||
|
_logger.LogWarning(
|
||||||
|
"PRSIG_API_ADD_DOC_RECEIVER_ELEM returned OUT_SUCCESS=false. DOC_ID={DocId}, RECEIVER_ID={ReceiverId}, Page={Page}",
|
||||||
|
document.Id, rcv.Id, sign.Page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -221,8 +225,6 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
#region Create history
|
#region Create history
|
||||||
// ENV_UID, STATUS_ID, USER_ID,
|
// ENV_UID, STATUS_ID, USER_ID,
|
||||||
string sql_hist = @"
|
string sql_hist = @"
|
||||||
USE [DD_ECM]
|
|
||||||
|
|
||||||
DECLARE @OUT_SUCCESS bit;
|
DECLARE @OUT_SUCCESS bit;
|
||||||
|
|
||||||
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
EXEC [dbo].[PRSIG_API_ADD_HISTORY_STATE]
|
||||||
@@ -244,6 +246,10 @@ public class EnvelopeReceiverController : ControllerBase
|
|||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
bool outSuccess = reader.GetBoolean(0);
|
bool outSuccess = reader.GetBoolean(0);
|
||||||
|
if (!outSuccess)
|
||||||
|
_logger.LogWarning(
|
||||||
|
"PRSIG_API_ADD_HISTORY_STATE returned OUT_SUCCESS=false. EnvelopeUuid={EnvelopeUuid}",
|
||||||
|
envelope.Uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFrameworks>net8.0</TargetFrameworks>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<PackageId>EnvelopeGenerator.Server</PackageId>
|
||||||
|
<Title></Title>
|
||||||
|
<Authors>Digital Data GmbH</Authors>
|
||||||
|
<Company>Digital Data GmbH</Company>
|
||||||
|
<Product>EnvelopeGenerator.Server</Product>
|
||||||
|
<Version>1.0.1-beta</Version>
|
||||||
|
<FileVersion>1.0.1.0</FileVersion>
|
||||||
|
<AssemblyVersion>1.0.1.0</AssemblyVersion>
|
||||||
|
<Copyright>Copyright © 2026 Digital Data GmbH. All rights reserved.</Copyright>
|
||||||
|
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
namespace EnvelopeGenerator.Server.Handlers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="DelegatingHandler"/> that forwards the incoming HTTP request's
|
||||||
|
/// <c>Cookie</c> header to all outgoing <see cref="System.Net.Http.HttpClient"/> calls
|
||||||
|
/// made by Blazor Server components.
|
||||||
|
///
|
||||||
|
/// Problem it solves:
|
||||||
|
/// Blazor Server runs on the server process. When a component calls an API endpoint
|
||||||
|
/// that requires cookie-based JWT authentication (AuthScheme.Sender), the HttpClient
|
||||||
|
/// does not automatically include the browser's cookies — those only travel with
|
||||||
|
/// browser-initiated requests. This handler copies the <c>Cookie</c> header from the
|
||||||
|
/// current <see cref="IHttpContextAccessor.HttpContext"/> into every outgoing request
|
||||||
|
/// so that the API's JwtBearer <c>OnMessageReceived</c> callback can extract the token.
|
||||||
|
///
|
||||||
|
/// Thread safety:
|
||||||
|
/// The handler is registered as Transient and is resolved per-request by the
|
||||||
|
/// IHttpClientFactory pipeline, so there is no shared state between requests.
|
||||||
|
/// </summary>
|
||||||
|
public class SenderAuthCookieHandler(IHttpContextAccessor httpContextAccessor) : DelegatingHandler
|
||||||
|
{
|
||||||
|
protected override Task<HttpResponseMessage> SendAsync(
|
||||||
|
HttpRequestMessage request,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var cookieHeader = httpContextAccessor.HttpContext?.Request.Headers["Cookie"].ToString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(cookieHeader))
|
||||||
|
request.Headers.TryAddWithoutValidation("Cookie", cookieHeader);
|
||||||
|
|
||||||
|
return base.SendAsync(request, cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,6 +69,9 @@ try
|
|||||||
builder.Services.AddHttpContextAccessor();
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|
||||||
// Named HttpClient for internal API calls
|
// Named HttpClient for internal API calls
|
||||||
|
// SenderAuthCookieHandler forwards the browser's Cookie header so that
|
||||||
|
// Blazor Server components can call cookie-authenticated endpoints (AuthScheme.Sender).
|
||||||
|
builder.Services.AddTransient<EnvelopeGenerator.Server.Handlers.SenderAuthCookieHandler>();
|
||||||
builder.Services.AddHttpClient("EnvelopeGenerator.Server", (sp, client) =>
|
builder.Services.AddHttpClient("EnvelopeGenerator.Server", (sp, client) =>
|
||||||
{
|
{
|
||||||
var httpContextAccessor = sp.GetRequiredService<IHttpContextAccessor>();
|
var httpContextAccessor = sp.GetRequiredService<IHttpContextAccessor>();
|
||||||
@@ -79,7 +82,8 @@ try
|
|||||||
// Set base address to current host for SSR scenarios
|
// Set base address to current host for SSR scenarios
|
||||||
client.BaseAddress = new Uri($"{request.Scheme}://{request.Host}");
|
client.BaseAddress = new Uri($"{request.Scheme}://{request.Host}");
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.AddHttpMessageHandler<EnvelopeGenerator.Server.Handlers.SenderAuthCookieHandler>();
|
||||||
|
|
||||||
// CORS Policy
|
// CORS Policy
|
||||||
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
|
var allowedOrigins = config.GetSection("AllowedOrigins").Get<string[]>() ??
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||||
|
-->
|
||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<WebPublishMethod>Package</WebPublishMethod>
|
||||||
|
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||||
|
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||||
|
<SiteUrlToLaunchAfterPublish />
|
||||||
|
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||||
|
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||||
|
<ProjectGuid>5e0e17c0-ff5a-4246-bf87-1add85376a27</ProjectGuid>
|
||||||
|
<DesktopBuildPackageLocation>M:\App&Service\0 DD - Smart UP\signFLOW\API\net8\$(Version)\EnvelopeGenerator.Server.zip</DesktopBuildPackageLocation>
|
||||||
|
<PackageAsSingleFile>true</PackageAsSingleFile>
|
||||||
|
<DeployIisAppPath>EnvelopeGenerator</DeployIisAppPath>
|
||||||
|
<_TargetId>IISWebDeployPackage</_TargetId>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<SelfContained>true</SelfContained>
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
<EnvironmentName>Production</EnvironmentName>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
225
EnvelopeGenerator.Server/EnvelopeGenerator.Server/README.md
Normal file
225
EnvelopeGenerator.Server/EnvelopeGenerator.Server/README.md
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
# EnvelopeGenerator.Server — Publish & Deployment Guide
|
||||||
|
|
||||||
|
## Inhaltsverzeichnis
|
||||||
|
|
||||||
|
1. [Unterschied zu einer normalen ASP.NET Core API](#unterschied-zu-einer-normalen-aspnet-core-api)
|
||||||
|
2. [Warum Self-Contained Publish?](#warum-self-contained-publish)
|
||||||
|
3. [Publish-Befehl (Terminal)](#publish-befehl-terminal)
|
||||||
|
4. [IIS-Konfiguration](#iis-konfiguration)
|
||||||
|
5. [Verzeichnisstruktur nach dem Publish](#verzeichnisstruktur-nach-dem-publish)
|
||||||
|
6. [Häufige Fehler](#häufige-fehler)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Unterschied zu einer normalen ASP.NET Core API
|
||||||
|
|
||||||
|
`EnvelopeGenerator.Server` ist **keine** gewöhnliche ASP.NET Core Web API. Es handelt sich um eine **Blazor Auto (Server + WebAssembly Hybrid)**-Anwendung.
|
||||||
|
|
||||||
|
| Merkmal | Normale ASP.NET Core API | EnvelopeGenerator.Server (Blazor Auto) |
|
||||||
|
|---|---|---|
|
||||||
|
| Projekttyp | `Microsoft.NET.Sdk.Web` | `Microsoft.NET.Sdk.Web` + WASM Client |
|
||||||
|
| Frontend | Keins / Razor Pages | Blazor Server + Blazor WASM |
|
||||||
|
| WASM-Komponente | Nein | Ja (`EnvelopeGenerator.Server.Client`) |
|
||||||
|
| Framework-DLL-Bindung | Tolerant gegenüber Runtime-Versionen | **Strikt**: WASM erwartet exakte Assembly-Versionen |
|
||||||
|
| Publish ohne .NET auf Zielserver | Nicht nötig (FDD reicht meist) | **Self-Contained Pflicht** empfohlen |
|
||||||
|
| IIS Application Pool | `.NET CLR v4.0` oder `No Managed Code` | **Zwingend: `No Managed Code`** |
|
||||||
|
| Publish-Paketgröße | ~5–20 MB | **~500 MB** (enthält .NET Runtime) |
|
||||||
|
| `web.config processPath` | `dotnet` + `.dll` | **`.\EnvelopeGenerator.Server.exe`** |
|
||||||
|
|
||||||
|
### Warum die WASM-Komponente den Unterschied macht
|
||||||
|
|
||||||
|
Die WASM-Seite der Anwendung (`EnvelopeGenerator.Server.Client`) bindet Assemblies wie
|
||||||
|
`Microsoft.Extensions.DependencyInjection.Abstractions` in einer **fest definierten Version**.
|
||||||
|
Bei einem **Framework-Dependent Deployment** werden diese Assemblies nicht mitgeliefert und
|
||||||
|
müssen auf dem Zielserver vorhanden sein — in der exakt passenden Version.
|
||||||
|
|
||||||
|
Fehlt die passende .NET-Runtime auf dem Zielserver, erscheint folgender Fehler beim Start:
|
||||||
|
|
||||||
|
```
|
||||||
|
Unhandled exception. System.IO.FileNotFoundException:
|
||||||
|
Could not load file or assembly
|
||||||
|
'Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.0'
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Warum Self-Contained Publish?
|
||||||
|
|
||||||
|
Beim **Self-Contained Deployment** werden **alle benötigten .NET Runtime-DLLs** in das
|
||||||
|
Ausgabeverzeichnis kopiert. Die Anwendung ist damit vollständig unabhängig von der auf dem
|
||||||
|
Zielserver installierten .NET-Version.
|
||||||
|
|
||||||
|
| | Framework-Dependent | Self-Contained |
|
||||||
|
|---|---|---|
|
||||||
|
| .NET auf Zielserver nötig | Ja | **Nein** |
|
||||||
|
| Paketgröße | ~20 MB | ~500 MB |
|
||||||
|
| `runtimeconfig.json` | `frameworkVersion` vorhanden | `includedFrameworks` (Runtime eingebettet) |
|
||||||
|
| Fehleranfälligkeit auf Fremd-PC | Hoch | Minimal |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Publish-Befehl (Terminal)
|
||||||
|
|
||||||
|
### Empfohlener Befehl (Self-Contained, win-x64)
|
||||||
|
|
||||||
|
```bat
|
||||||
|
dotnet publish EnvelopeGenerator.Server\EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj ^
|
||||||
|
-c Release ^
|
||||||
|
-f net8.0 ^
|
||||||
|
--self-contained true ^
|
||||||
|
--runtime win-x64 ^
|
||||||
|
-o .\publish-output
|
||||||
|
```
|
||||||
|
|
||||||
|
> Dieser Befehl muss vom **Solution-Root-Verzeichnis** aus ausgefuehrt werden.
|
||||||
|
> Alternativ: `publish.bat` im selben Verzeichnis wie diese README ausfuehren.
|
||||||
|
|
||||||
|
### Parameter-Erklaerung
|
||||||
|
|
||||||
|
| Parameter | Bedeutung |
|
||||||
|
|---|---|
|
||||||
|
| `-c Release` | Release-Konfiguration (optimiert, kein Debug-Code) |
|
||||||
|
| `-f net8.0` | Ziel-Framework explizit angeben (Pflicht, da `<TargetFrameworks>` mehrere Werte haben kann) |
|
||||||
|
| `--self-contained true` | Alle .NET Runtime-DLLs ins Ausgabeverzeichnis kopieren |
|
||||||
|
| `--runtime win-x64` | Zielplattform: Windows 64-Bit |
|
||||||
|
| `-o .\publish-output` | Ausgabeverzeichnis |
|
||||||
|
|
||||||
|
### Doğrulama nach dem Publish
|
||||||
|
|
||||||
|
Nach erfolgreichem Publish folgende Dateien im Ausgabeverzeichnis prüfen:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Diese Dateien MÜSSEN vorhanden sein (Self-Contained-Nachweis):
|
||||||
|
Test-Path ".\publish-output\hostfxr.dll" # .NET Host
|
||||||
|
Test-Path ".\publish-output\coreclr.dll" # .NET Core Runtime
|
||||||
|
Test-Path ".\publish-output\Microsoft.Extensions.DependencyInjection.Abstractions.dll"
|
||||||
|
Test-Path ".\publish-output\EnvelopeGenerator.Server.exe"
|
||||||
|
Test-Path ".\publish-output\web.config"
|
||||||
|
```
|
||||||
|
|
||||||
|
Alle Ergebnisse müssen `True` sein.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## IIS-Konfiguration
|
||||||
|
|
||||||
|
> **WICHTIG:** Diese Einstellungen unterscheiden sich von einer normalen ASP.NET Core API
|
||||||
|
> und sind zwingend erforderlich.
|
||||||
|
|
||||||
|
### 1. Application Pool — `No Managed Code`
|
||||||
|
|
||||||
|
ASP.NET Core (und damit auch Blazor) verwaltet seinen eigenen Runtime-Lifecycle.
|
||||||
|
IIS darf **keinen** .NET CLR-Managed-Code-Kontext aktivieren.
|
||||||
|
|
||||||
|
**Einstellung:**
|
||||||
|
|
||||||
|
```
|
||||||
|
IIS Manager
|
||||||
|
→ Application Pools
|
||||||
|
→ [Pool-Name der Anwendung] → Basic Settings
|
||||||
|
→ .NET CLR Version: "No Managed Code" ← ZWINGEND
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Fehler bei falscher Einstellung:** HTTP 500.30 — ASP.NET Core app failed to start
|
||||||
|
> (sc-win32-status: 574 in IIS-Logs)
|
||||||
|
|
||||||
|
### 2. ASP.NET Core Module V2
|
||||||
|
|
||||||
|
Das IIS-Modul `AspNetCoreModuleV2` muss installiert sein.
|
||||||
|
Es wird über das **.NET Hosting Bundle** mitgeliefert.
|
||||||
|
|
||||||
|
Prüfen:
|
||||||
|
```
|
||||||
|
IIS Manager → Modules → "AspNetCoreModuleV2" vorhanden?
|
||||||
|
```
|
||||||
|
|
||||||
|
Falls nicht installiert: [.NET 8 Hosting Bundle herunterladen](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||||
|
und nach der Installation IIS neu starten:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
net stop was /y && net start w3svc
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. web.config — Korrekte Konfiguration für Self-Contained
|
||||||
|
|
||||||
|
Nach dem Publish wird `web.config` automatisch generiert. Für Self-Contained muss sie so aussehen:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<location path="." inheritInChildApplications="false">
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name="aspNetCore" path="*" verb="*"
|
||||||
|
modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||||
|
</handlers>
|
||||||
|
<aspNetCore processPath=".\EnvelopeGenerator.Server.exe"
|
||||||
|
stdoutLogEnabled="false"
|
||||||
|
stdoutLogFile=".\logs\stdout"
|
||||||
|
hostingModel="inprocess" />
|
||||||
|
</system.webServer>
|
||||||
|
</location>
|
||||||
|
</configuration>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Kritische Unterschiede zu Framework-Dependent:**
|
||||||
|
|
||||||
|
| Eigenschaft | Framework-Dependent (FALSCH) | Self-Contained (RICHTIG) |
|
||||||
|
|---|---|---|
|
||||||
|
| `processPath` | `dotnet` | `.\EnvelopeGenerator.Server.exe` |
|
||||||
|
| `arguments` | `.\EnvelopeGenerator.Server.dll` | *(leer oder weggelassen)* |
|
||||||
|
|
||||||
|
### 4. Berechtigungen für das `logs`-Verzeichnis
|
||||||
|
|
||||||
|
Wenn `stdoutLogEnabled="true"` gesetzt wird (zur Fehlerdiagnose), muss das `logs`-Verzeichnis
|
||||||
|
existieren und der IIS-Prozess muss Schreibrechte haben:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
New-Item -ItemType Directory -Path "C:\inetpub\wwwroot\<App-Pfad>\logs" -Force
|
||||||
|
icacls "C:\inetpub\wwwroot\<App-Pfad>\logs" /grant "IIS_IUSRS:(OI)(CI)F"
|
||||||
|
```
|
||||||
|
|
||||||
|
> Ohne dieses Verzeichnis kann die Anwendung bei aktiviertem Logging **nicht starten**.
|
||||||
|
|
||||||
|
### 5. Application Pool Recycle nach Deployment
|
||||||
|
|
||||||
|
Nach jedem Deployment den Application Pool neu starten:
|
||||||
|
|
||||||
|
```cmd
|
||||||
|
# IIS Manager → Application Pools → [Pool] → Recycle
|
||||||
|
# oder per Kommandozeile (als Administrator):
|
||||||
|
%windir%\system32\inetsrv\appcmd recycle apppool /apppool.name:"<Pool-Name>"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Verzeichnisstruktur nach dem Publish
|
||||||
|
|
||||||
|
```
|
||||||
|
publish-output\
|
||||||
|
├── EnvelopeGenerator.Server.exe ← Startpunkt (Self-Contained)
|
||||||
|
├── EnvelopeGenerator.Server.dll ← Managed Assembly
|
||||||
|
├── EnvelopeGenerator.Server.runtimeconfig.json
|
||||||
|
├── EnvelopeGenerator.Server.deps.json
|
||||||
|
├── web.config ← IIS-Konfiguration (auto-generiert)
|
||||||
|
├── hostfxr.dll ← .NET Host (Self-Contained-Nachweis)
|
||||||
|
├── coreclr.dll ← .NET Core Runtime
|
||||||
|
├── Microsoft.Extensions.*.dll ← Framework-DLLs (jetzt enthalten!)
|
||||||
|
├── DevExpress.*.dll ← UI-Komponenten
|
||||||
|
├── wwwroot\ ← Statische Web-Assets
|
||||||
|
│ ├── _framework\ ← WASM-Binaries
|
||||||
|
│ └── ...
|
||||||
|
└── logs\ ← Stdout-Logs (manuell anlegen!)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Häufige Fehler
|
||||||
|
|
||||||
|
| Fehler | Ursache | Lösung |
|
||||||
|
|---|---|---|
|
||||||
|
| `FileNotFoundException: Microsoft.Extensions.DependencyInjection.Abstractions` | Framework-Dependent Publish auf Server ohne .NET 8 | Self-Contained Publish verwenden |
|
||||||
|
| `HTTP 500.30` in IIS | App startet nicht | Application Pool auf `No Managed Code` setzen |
|
||||||
|
| `HTTP 500.30` + `sc-win32-status: 574` | App Pool falsch oder `AspNetCoreModuleV2` fehlt | Pool prüfen + Hosting Bundle installieren |
|
||||||
|
| App startet per `.exe`, aber nicht in IIS | `web.config` hat noch `processPath="dotnet"` | `web.config` auf `.\EnvelopeGenerator.Server.exe` korrigieren |
|
||||||
|
| Logs-Verzeichnis fehlt → App startet nicht | `stdoutLogEnabled="true"` aber `logs\` existiert nicht | `logs\`-Ordner anlegen + IIS_IUSRS Schreibrecht geben |
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"dotnet-ef": {
|
||||||
|
"version": "10.0.9",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-ef"
|
||||||
|
],
|
||||||
|
"rollForward": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
96
EnvelopeGenerator.Server/publish.bat
Normal file
96
EnvelopeGenerator.Server/publish.bat
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
echo ============================================================
|
||||||
|
echo EnvelopeGenerator.Server - Self-Contained Publish
|
||||||
|
echo Target: win-x64 / .NET 8 / Release
|
||||||
|
echo ============================================================
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM Must be run from the solution root directory.
|
||||||
|
REM This file is located under: EnvelopeGenerator.Server\
|
||||||
|
|
||||||
|
set PROJECT=EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj
|
||||||
|
set OUTPUT=publish-output
|
||||||
|
set RID=win-x64
|
||||||
|
set FRAMEWORK=net8.0
|
||||||
|
|
||||||
|
echo [1/3] Cleaning previous publish output...
|
||||||
|
if exist "%OUTPUT%" (
|
||||||
|
rmdir /s /q "%OUTPUT%"
|
||||||
|
echo Removed: %OUTPUT%
|
||||||
|
) else (
|
||||||
|
echo Nothing to clean.
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
|
||||||
|
echo [2/3] Publishing...
|
||||||
|
echo Project : %PROJECT%
|
||||||
|
echo Output : %OUTPUT%
|
||||||
|
echo RID : %RID%
|
||||||
|
echo Framework: %FRAMEWORK%
|
||||||
|
echo.
|
||||||
|
|
||||||
|
dotnet publish "%PROJECT%" ^
|
||||||
|
-c Release ^
|
||||||
|
-f %FRAMEWORK% ^
|
||||||
|
--self-contained true ^
|
||||||
|
--runtime %RID% ^
|
||||||
|
-o "%OUTPUT%"
|
||||||
|
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo.
|
||||||
|
echo [ERROR] Publish failed! ERRORLEVEL=%ERRORLEVEL%
|
||||||
|
pause
|
||||||
|
exit /b %ERRORLEVEL%
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo [3/3] Verifying output...
|
||||||
|
|
||||||
|
set PASS=1
|
||||||
|
|
||||||
|
if not exist "%OUTPUT%\EnvelopeGenerator.Server.exe" (
|
||||||
|
echo [FAIL] EnvelopeGenerator.Server.exe not found!
|
||||||
|
set PASS=0
|
||||||
|
)
|
||||||
|
if not exist "%OUTPUT%\hostfxr.dll" (
|
||||||
|
echo [FAIL] hostfxr.dll not found! (Not a self-contained publish?)
|
||||||
|
set PASS=0
|
||||||
|
)
|
||||||
|
if not exist "%OUTPUT%\coreclr.dll" (
|
||||||
|
echo [FAIL] coreclr.dll not found! (Not a self-contained publish?)
|
||||||
|
set PASS=0
|
||||||
|
)
|
||||||
|
if not exist "%OUTPUT%\Microsoft.Extensions.DependencyInjection.Abstractions.dll" (
|
||||||
|
echo [FAIL] Microsoft.Extensions.DependencyInjection.Abstractions.dll not found!
|
||||||
|
set PASS=0
|
||||||
|
)
|
||||||
|
if not exist "%OUTPUT%\web.config" (
|
||||||
|
echo [FAIL] web.config not found!
|
||||||
|
set PASS=0
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%PASS%"=="1" (
|
||||||
|
echo.
|
||||||
|
echo ============================================================
|
||||||
|
echo PUBLISH SUCCEEDED
|
||||||
|
echo Output folder: %~dp0%OUTPUT%
|
||||||
|
echo ============================================================
|
||||||
|
echo.
|
||||||
|
echo Next steps:
|
||||||
|
echo 1. Copy the contents of '%OUTPUT%' to the IIS application directory
|
||||||
|
echo 2. Set the IIS Application Pool to 'No Managed Code'
|
||||||
|
echo 3. Recycle the Application Pool
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
echo.
|
||||||
|
echo ============================================================
|
||||||
|
echo PUBLISH COMPLETED BUT VERIFICATION FAILED
|
||||||
|
echo Review the FAIL messages above.
|
||||||
|
echo ============================================================
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
pause
|
||||||
|
endlocal
|
||||||
@@ -45,6 +45,9 @@ EndProject
|
|||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.ReceiverUI", "EnvelopeGenerator.ReceiverUI\EnvelopeGenerator.ReceiverUI.csproj", "{FB2D306B-1042-4A70-31ED-F991A1599371}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.ReceiverUI", "EnvelopeGenerator.ReceiverUI\EnvelopeGenerator.ReceiverUI.csproj", "{FB2D306B-1042-4A70-31ED-F991A1599371}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EnvelopeGenerator.Server", "EnvelopeGenerator.Server", "{BF1700D5-592E-4FFA-84E8-5480E289A1F0}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EnvelopeGenerator.Server", "EnvelopeGenerator.Server", "{BF1700D5-592E-4FFA-84E8-5480E289A1F0}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
EnvelopeGenerator.Server\publish.bat = EnvelopeGenerator.Server\publish.bat
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.Server", "EnvelopeGenerator.Server\EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj", "{4E6C54DA-576D-0955-2564-9EC890BB8279}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvelopeGenerator.Server", "EnvelopeGenerator.Server\EnvelopeGenerator.Server\EnvelopeGenerator.Server.csproj", "{4E6C54DA-576D-0955-2564-9EC890BB8279}"
|
||||||
EndProject
|
EndProject
|
||||||
|
|||||||
Reference in New Issue
Block a user