Diskuze: Problém s publikováním ASP.NET aplikace
V předchozím kvízu, Test znalostí C# .NET online, jsme si ověřili nabyté zkušenosti z kurzu.
Maros2470:10.4.2015 6:33
Při spuštění na testovacím serveru to běhá normálně
Nemáš tam někde uvedenou cestu někam "natvrdo" místo relativní
cesty?
...
Spotrebice.Spotrebice.SpotrebiceRole.createSpotr() in
g:\C#\Programování\2013\WF\Spotrebice\Spotrebice\Spotrebice\SpotrebiceRole.cs:32
Spotrebice.Global.Application_Start(Object sender, EventArgs e) in
g:\C#\Programování\2013\WF\Spotrebice\Spotrebice\Global.asax.cs:26
Maros2470:10.4.2015 8:32
Už se ta vyjímka trochu změnila, ale jsem z toho jelen.
Server Error in '/' Application.
Inheritance security rules violated while overriding member: 'Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1<T>.UnsafeOnCompleted(System.Action)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Inheritance security rules violated while overriding member: 'Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1<T>.UnsafeOnCompleted(System.Action)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[TypeLoadException: Inheritance security rules violated while overriding
member:
'Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1<T>.UnsafeOnCompleted(System.Action)'.
Security accessibility of the overriding method must match the security
accessibility of the method being overriden.]
Microsoft.AspNet.Identity.RoleManager`2.RoleExistsAsync(String roleName)
+0
Microsoft.AspNet.Identity.<>c__DisplayClass10`2.<RoleExists>b__f()
+18
Microsoft.AspNet.Identity.<>c__DisplayClass1`1.<RunSync>b__0()
+50
System.Threading.Tasks.Task`1.InnerInvoke() +60
System.Threading.Tasks.Task.Execute() +45
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +52
Microsoft.AspNet.Identity.AsyncHelper.RunSync(Func`1 func) +166
Microsoft.AspNet.Identity.RoleManagerExtensions.RoleExists(RoleManager`2
manager, String roleName) +104
Spotrebice.Spotrebice.SpotrebiceRole.createSpotr() +115
Spotrebice.Global.Application_Start(Object sender, EventArgs e) +47
[HttpException (0x80004005): Inheritance security rules violated while
overriding member:
'Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1<T>.UnsafeOnCompleted(System.Action)'.
Security accessibility of the overriding method must match the security
accessibility of the method being overriden.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +9936761
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +296
[HttpException (0x80004005): Inheritance security rules violated while
overriding member:
'Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1<T>.UnsafeOnCompleted(System.Action)'.
Security accessibility of the overriding method must match the security
accessibility of the method being overriden.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9915300
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18449
Michal Štěpánek:10.4.2015 8:36
Taky z toho moc moudrej nejsem, ale je tam spousta záznamů o Microsoft.AspNet.Identity, tak jestli nebude problém někde kolem ověřování uživatele...
Maros2470:10.4.2015 15:45
Na aspone.cz mi nastavili vyšší práva. Teď už je problém asi jen s connectionString. Vyjímka teď vypadá takto:
Server Error in '/' Application.
The system cannot find the file specified
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the file specified]
[SqlException (0x80131904): A network-related or instance-specific error
occurred while establishing a connection to SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections. (provider: SQL Network
Interfaces, error: 52 - Unable to locate a Local Database Runtime installation.
Verify that SQL Server Express is properly installed and that the Local Database
Runtime feature is enabled.)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6749670
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,
SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64
timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean
integratedSecurity, Boolean withFailover) +6775368
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential
credential, TimeoutTimer timeout) +6777796
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer
timeout, SqlConnectionString connectionOptions, SqlCredential credential, String
newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
+6778255
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
identity, SqlConnectionString connectionOptions, SqlCredential credential,
Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance, SqlConnectionString userConnectionOptions,
SessionData reconnectSessionData) +878
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions
options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions
userOptions) +1162
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool
pool, DbConnection owningObject, DbConnectionOptions options,
DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owningObject, DbConnectionOptions userOptions, DbConnectionInternal
oldConnection) +6781425
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection
owningObject, DbConnectionOptions userOptions, DbConnectionInternal
oldConnection) +103
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate,
Boolean onlyOneCheckConnection, DbConnectionOptions userOptions,
DbConnectionInternal& connection) +2105
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection
owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions,
DbConnectionInternal& connection) +116
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection
owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions
userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&
connection) +1089
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection
outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1
retry, DbConnectionOptions userOptions) +6785863
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1
retry) +233
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1
retry) +278
System.Data.SqlClient.SqlConnection.Open() +239
System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch(TTarget target, Action
2
operation, TInterceptionContext interceptionContext,
Action3 executing, Action
3 executed) +207
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection
connection, DbInterceptionContext interceptionContext) +438
System.Data.Entity.SqlServer.<>c__DisplayClass1.<Execute>b__0()
+15
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1
operation) +263
System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection
sqlConnection, Action`1 act) +391
System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection
sqlConnection, Action`1 act) +749
System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection
connection, Nullable`1 commandTimeout, StoreItemCollection
storeItemCollection) +314
System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection
connection) +281
System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action
mustSucceedToKeepDatabase) +230
System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext
internalContext, Func`3 createMigrator, ObjectContext objectContext) +130
System.Data.Entity.Database.Create(DatabaseExistenceState
existenceState) +267
System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext
context) +243
System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action
action) +66
System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
+596
System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
+208
System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1
action) +266
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type
entityType) +39
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +72
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
+21
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
+64
System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable1 source, Expression
1
predicate, CancellationToken cancellationToken) +218
System.Data.Entity.QueryableExtensions.FirstOrDefaultAsync(IQueryable1 source, Expression
1
predicate) +113
Microsoft.AspNet.Identity.<FindByNameAsync>d__13.MoveNext() +229
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +144
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +84
Microsoft.AspNet.Identity.<RoleExistsAsync>d__d.MoveNext() +455
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) +144
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) +84
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +49
Microsoft.AspNet.Identity.AsyncHelper.RunSync(Func`1 func) +235
Spotrebice.Spotrebice.SpotrebiceRole.createSpotr() +127
[HttpException (0x80004005): A network-related or instance-specific error
occurred while establishing a connection to SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections. (provider: SQL Network
Interfaces, error: 52 - Unable to locate a Local Database Runtime installation.
Verify that SQL Server Express is properly installed and that the Local Database
Runtime feature is enabled.)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +12951237
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +175
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +404
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +475
[HttpException (0x80004005): A network-related or instance-specific error
occurred while establishing a connection to SQL Server. The server was not found
or was not accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections. (provider: SQL Network
Interfaces, error: 52 - Unable to locate a Local Database Runtime installation.
Verify that SQL Server Express is properly installed and that the Local Database
Runtime feature is enabled.)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +12807949
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18449
Michal Štěpánek:10.4.2015 19:33
Napiš, jaký máš ConnectionString. DB jsi na aspone nahrál? Pokud ji máš jen jako soubor v App_Data, myslím, že zrovna na aspone to s tím nechodí, že musí být extra databáze...
Maros2470:10.4.2015 19:59
Stále problémy. Zkusil bych vytvořit databázi přímo na tom serveru, kde bude aplikace. Můžeš mi poradit jak již hotovou databázi mdf nascriptovat? Pak bych jí zkusil natáhnout na server. ConnectionString se mi tam vygeneroval. Jen nevím jestli to bude fungovat s Entity
Maros2470:10.4.2015 20:00
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-Spotrebice-20140927072246.mdf;Initial Catalog=aspnet-Spotrebice-20140927072246;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="SpotrebiceEntities" connectionString="metadata=res://*/MyModel.csdl|res://*/MyModel.ssdl|res://*/MyModel.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\v11.0;attachdbfilename=|DataDirectory|\Spotrebice.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
<add name="ConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Spotrebice.mdf;Integrated Security=True;Connect Timeout=30"
providerName="System.Data.SqlClient" />
<add name="ConnectionString2" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\SpravaDat.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Maros2470:10.4.2015 20:02
Nevím jak tam tu databázi nahrát. Je jen v app_data. Dělám to poprvé a na aspone fóru jsem taky z toho nebyl moudrý
Maros2470:10.4.2015 22:58
Vytvořil jsem databázi ručně. Teď to celkem chodí, ale mám zase problém s importem dat z excelu:
Server Error in '/' Application.
Could not find a part of the path 'D:\Websites\f1a0cce7f0\www\ImportDocument\758c35e1-4054-4fd5-9ff9-68c4b7b90868.xlsx'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Websites\f1a0cce7f0\www\ImportDocument\758c35e1-4054-4fd5-9ff9-68c4b7b90868.xlsx'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[DirectoryNotFoundException: Could not find a part of the path
'D:\Websites\f1a0cce7f0\www\ImportDocument\758c35e1-4054-4fd5-9ff9-68c4b7b90868.xlsx'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +338
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32
rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions
options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy,
Boolean useLongPath, Boolean checkHost) +1430
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean
bFromProxy) +208
System.IO.FileStream..ctor(String path, FileMode mode) +91
System.Web.HttpPostedFile.SaveAs(String filename) +160
Spotrebice.Admin.ImportExcel.btnImportCSV_Click(Object sender, EventArgs
e) +366
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
+155
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+3804
Maros2470:11.4.2015 0:20
Snad už to běží. Teď už mám jen jeden problém:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local
machine.
Na aspone.cz funguje aj mdf v App_Data.
Toto som našiel v maili, kde som to s nimi riešil.
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NAZEVDB.mdf;Integrated Security=True;User Instance=True;Database=nazev" providerName="System.Data.SqlClient" />
Maros2470:11.4.2015 0:49
Tohle mi, ale nefungovalo. Nevíš náhodou co s tímhle?
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Používaš tú knižnicu na otázky prácu s excelom a na tom serveri zrejme
nie je (aj keď to by asi chyba vyzerala inak) alebo toto:
www.codeproject.com/…e-Local-Mach
Alebo treba v IIS povoliť 32 bitové aplikácie, v prípade, že je tam 64
bit.
Možností je veľa.
Ľuboš Čurgó:11.4.2015 16:00
Databazu vies preniest tak, ze v SQL Managment studiu si nechas vygenerovat create script nad databazou ktory potom spustis v administracnom prostredi aspone.
Zobrazeno 19 zpráv z 19.